Showing posts with label build. Show all posts
Showing posts with label build. Show all posts

Friday, March 30, 2012

Role deleted

I get this error when I try to build my cube.

Error 1 The 'Role' with 'ID' = 'Sales_Marketing' doesn't exist in the collection. 0 0

I had added and deleted some roles, now I receive this message, does anyone have any idea where do I go find this code to delele this role, it no longer exists in my cube? in the designer tool or in management studio.

thank you!

Analysis Services security is based on the role objects that belong to a database. At the same time, individual objects like cubes and dimensions also contain additional security related objects that reference database role objects. If you set permission on a dimension and then you get XMLA script of dimensions defition, you will see DimensionPermission object as part of a XMLA script.

This DimensionPermission object would look like:

<DimensionPermission>

<ID>DimensionPermission</ID>

<Name>DimensionPermission</Name>

<RoleID>Role</RoleID>

<ReadDefinition>Allowed</ReadDefinition>

<Read>Allowed</Read>

</DimensionPermission>

As you see it references RoleID.

Most likely in your case there is a leftover permission object that references non-existent role. Script your database as XMLA and try to find which Permission object is referencing your Sales_Marketing role.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

Thank you, my role is defined in my desktop tool, not on the server which will not allow me to build or deploy my cube. My permission looks like this, one is object ID Role and the second is Role 1. The one I deleted was probably Role 2 but I don't see where that is documented in the xml, I guess I could bring my deployed cube back to my desk top but I wanted to resolve the issue since I had made calculation changes there; Any ideas on how I can identify it? thank you!

</Dimension>

</Dimensions>

<CubePermissions>

<CubePermission dwdBig Smileesign-time-name="34abb275-a50e-48ab-89b1-bb47d248d4a3">

<ID>CubePermission</ID>

<Name>CubePermission</Name>

<CreatedTimestamp>0001-01-01T08:00:00Z</CreatedTimestamp>

<LastSchemaUpdate>0001-01-01T08:00:00Z</LastSchemaUpdate>

<RoleID>Role</RoleID>

<ReadDefinition>Basic</ReadDefinition>

<Read>Allowed</Read>

<ReadSourceData>Allowed</ReadSourceData>

<DimensionPermissions>

<DimensionPermission dwdBig Smileesign-time-name="76086471-b808-41e6-ba68-36fef34146a4">

<CubeDimensionID>Measures</CubeDimensionID>

<Read>Allowed</Read>

</DimensionPermission>

<DimensionPermission dwdBig Smileesign-time-name="d85a2673-a178-409e-a7dd-06271444acc0">

<CubeDimensionID>Dim TIME Fiscal</CubeDimensionID>

<Read>Allowed</Read>

<AttributePermissions>

<AttributePermission dwdBig Smileesign-time-name="be0c4193-c0cc-49a5-b4cb-354388d59896">

<AttributeID>Calendar Quarter</AttributeID>

<AllowedSet>{}</AllowedSet>

</AttributePermission>

</AttributePermissions>

</DimensionPermission>

</DimensionPermissions>

</CubePermission>

</CubePermissions>

|||

You can try to fix your project by opening the project files directly and finding reference to the offending permission object there.

Find the .cub file that contains definition of your cube and see if you can fix it.

Word of caution, it is very easy to mix up XML when editing it. Please make sure you make a copy of your project files before you edit them.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||

Hi,

Thank you for the information, I just rebuilt it from the server, I thought it would be a good thing to know how to repair, but don't have the time for reviewing any more xml, you are correct, it is very easy to mix it up.

Thank you for the help.

Friday, March 23, 2012

right justify left zero fill

I have to build a text file with a dollar amount that must be right
justified, left zero filled and no decimal. The field I am extracting data
from is 'amount' and defined as decimal 9(15,2).
Stan Gosselin
On Fri, 28 Oct 2005 05:35:03 -0700, Stan wrote:

>I have to build a text file with a dollar amount that must be right
>justified, left zero filled and no decimal. The field I am extracting data
>from is 'amount' and defined as decimal 9(15,2).
Hi Stan,
You can use the following expression:
RIGHT(REPLICATE('0', 11) + LTRIM(CAST(YourColumn * 100 AS INT)), 11)
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Thanks again Hugo. I'm just getting exposed to SQL and, because of a short
deadline, I am being lazy about finding the answers. I shoudl be looking
stuff up the old fashioned way.
Stan Gosselin
"Hugo Kornelis" wrote:

> On Fri, 28 Oct 2005 05:35:03 -0700, Stan wrote:
>
> Hi Stan,
> You can use the following expression:
> RIGHT(REPLICATE('0', 11) + LTRIM(CAST(YourColumn * 100 AS INT)), 11)
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||Hugo,
If you don't mind, I have a variation on the last question. I have the same
type field (decimal 9(15,2)) and the recipient of a conversion .txt file want
to see just the meaningful digits, no decimals, no zero fill but does want to
see a trailing minus sign for negative numbers. So they want to see 550.45
as 55045 and -45.25 as 4525-.
Should I be sending things like this or should I do a re-post?
Thanks for understanding.
Stan Gosselin
"Stan" wrote:
[vbcol=seagreen]
> Thanks again Hugo. I'm just getting exposed to SQL and, because of a short
> deadline, I am being lazy about finding the answers. I shoudl be looking
> stuff up the old fashioned way.
> --
> Stan Gosselin
>
> "Hugo Kornelis" wrote:
|||On Wed, 2 Nov 2005 13:24:02 -0800, Stan wrote:

>Hugo,
>If you don't mind, I have a variation on the last question. I have the same
>type field (decimal 9(15,2)) and the recipient of a conversion .txt file want
>to see just the meaningful digits, no decimals, no zero fill but does want to
>see a trailing minus sign for negative numbers. So they want to see 550.45
>as 55045 and -45.25 as 4525-.
>Should I be sending things like this or should I do a re-post?
>Thanks for understanding.
Hi Stan,
Sending like this is fine, though a repost might attract more eyes.
Generally, if the subject really changes, post a new message. If it's a
variation on the question, use a reply.
I see that Steve has already answered the question. I trust that his
reply is what you wanted.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Thanks for the direction Hugo!
Stan Gosselin
"Hugo Kornelis" wrote:

> On Wed, 2 Nov 2005 13:24:02 -0800, Stan wrote:
>
> Hi Stan,
> Sending like this is fine, though a repost might attract more eyes.
> Generally, if the subject really changes, post a new message. If it's a
> variation on the question, use a reply.
> I see that Steve has already answered the question. I trust that his
> reply is what you wanted.
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
sql

Wednesday, March 7, 2012

returning success of exec(@sql) into a variable

i'm trying to build up the following dynamically
EXEC @.result =master..xp_cmdshell 'dir c:\test\D0004' , no_output
print @.result
so far i have got this..
set @.strsql = 'exec master..xp_cmdshell '+"'"+' dir c:\test\'+@.foldername +
+"'"+' , no_output'
exec(strsql)
this work fine to execute, but i cannot find anyway of returning the
success/failure into the variable @.result
Please help
You can use sp_executesql with an output parameter for this...
declare @.strsql nvarchar(200)
declare @.result int
set @.strsql = 'exec @.result = master..xp_cmdshell '+"'"+' dir
c:\test\'+@.foldername +
+"'"+' , no_output'
exec sp_executesql @.strsql, '@.Result int OUTPUT', @.Result OUTPUT
print @.result
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
"mat" <mat@.discussions.microsoft.com> wrote in message
news:ADCB55FF-0912-4AFA-9747-BAEF494F6CAD@.microsoft.com...
> i'm trying to build up the following dynamically
> EXEC @.result =master..xp_cmdshell 'dir c:\test\D0004' , no_output
> print @.result
> so far i have got this..
> set @.strsql = 'exec master..xp_cmdshell '+"'"+' dir c:\test\'+@.foldername
+
> +"'"+' , no_output'
> exec(strsql)
> this work fine to execute, but i cannot find anyway of returning the
> success/failure into the variable @.result
> Please help
|||Thanks, I'm running this and butt i'm getting the error message
Server: Msg 214, Level 16, State 3, Procedure sp_executesql, Line 38
Procedure expects parameter '@.parameters' of type 'ntext/nchar/nvarchar'.
"Adam Machanic" wrote:

> You can use sp_executesql with an output parameter for this...
> declare @.strsql nvarchar(200)
> declare @.result int
> set @.strsql = 'exec @.result = master..xp_cmdshell '+"'"+' dir
> c:\test\'+@.foldername +
> +"'"+' , no_output'
> exec sp_executesql @.strsql, '@.Result int OUTPUT', @.Result OUTPUT
> print @.result
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
> "mat" <mat@.discussions.microsoft.com> wrote in message
> news:ADCB55FF-0912-4AFA-9747-BAEF494F6CAD@.microsoft.com...
> +
>
>
|||Should have used the 'national' designator for the @.parameters string
literal:
exec sp_executesql @.strsql, N'@.Result int OUTPUT', @.Result OUTPUT
That tells SQL Server that the string is Unicode.
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
"Mat" <Mat@.discussions.microsoft.com> wrote in message
news:02ACC243-14F2-4A23-A5E4-C88CFE09EF74@.microsoft.com...[vbcol=seagreen]
> Thanks, I'm running this and butt i'm getting the error message
> Server: Msg 214, Level 16, State 3, Procedure sp_executesql, Line 38
> Procedure expects parameter '@.parameters' of type 'ntext/nchar/nvarchar'.
> "Adam Machanic" wrote:
c:\test\'+@.foldername[vbcol=seagreen]

returning success of exec(@sql) into a variable

i'm trying to build up the following dynamically
EXEC @.result =master..xp_cmdshell 'dir c:\test\D0004' , no_output
print @.result
so far i have got this..
set @.strsql = 'exec master..xp_cmdshell '+"'"+' dir c:\test\'+@.foldername +
+"'"+' , no_output'
exec(strsql)
this work fine to execute, but i cannot find anyway of returning the
success/failure into the variable @.result
Please helpYou can use sp_executesql with an output parameter for this...
declare @.strsql nvarchar(200)
declare @.result int
set @.strsql = 'exec @.result = master..xp_cmdshell '+"'"+' dir
c:\test'+@.foldername +
+"'"+' , no_output'
exec sp_executesql @.strsql, '@.Result int OUTPUT', @.Result OUTPUT
print @.result
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"mat" <mat@.discussions.microsoft.com> wrote in message
news:ADCB55FF-0912-4AFA-9747-BAEF494F6CAD@.microsoft.com...
> i'm trying to build up the following dynamically
> EXEC @.result =master..xp_cmdshell 'dir c:\test\D0004' , no_output
> print @.result
> so far i have got this..
> set @.strsql = 'exec master..xp_cmdshell '+"'"+' dir c:\test'+@.foldername
+
> +"'"+' , no_output'
> exec(strsql)
> this work fine to execute, but i cannot find anyway of returning the
> success/failure into the variable @.result
> Please help|||Thanks, I'm running this and butt i'm getting the error message
Server: Msg 214, Level 16, State 3, Procedure sp_executesql, Line 38
Procedure expects parameter '@.parameters' of type 'ntext/nchar/nvarchar'.
"Adam Machanic" wrote:

> You can use sp_executesql with an output parameter for this...
> declare @.strsql nvarchar(200)
> declare @.result int
> set @.strsql = 'exec @.result = master..xp_cmdshell '+"'"+' dir
> c:\test'+@.foldername +
> +"'"+' , no_output'
> exec sp_executesql @.strsql, '@.Result int OUTPUT', @.Result OUTPUT
> print @.result
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
> "mat" <mat@.discussions.microsoft.com> wrote in message
> news:ADCB55FF-0912-4AFA-9747-BAEF494F6CAD@.microsoft.com...
> +
>
>|||Should have used the 'national' designator for the @.parameters string
literal:
exec sp_executesql @.strsql, N'@.Result int OUTPUT', @.Result OUTPUT
That tells SQL Server that the string is Unicode.
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Mat" <Mat@.discussions.microsoft.com> wrote in message
news:02ACC243-14F2-4A23-A5E4-C88CFE09EF74@.microsoft.com...[vbcol=seagreen]
> Thanks, I'm running this and butt i'm getting the error message
> Server: Msg 214, Level 16, State 3, Procedure sp_executesql, Line 38
> Procedure expects parameter '@.parameters' of type 'ntext/nchar/nvarchar'.
> "Adam Machanic" wrote:
>
c:\test'+@.foldername[vbcol=seagreen]

returning success of exec(@sql) into a variable

i'm trying to build up the following dynamically
EXEC @.result =master..xp_cmdshell 'dir c:\test\D0004' , no_output
print @.result
so far i have got this..
set @.strsql = 'exec master..xp_cmdshell '+"'"+' dir c:\test\'+@.foldername +
+"'"+' , no_output'
exec(strsql)
this work fine to execute, but i cannot find anyway of returning the
success/failure into the variable @.result
Please helpYou can use sp_executesql with an output parameter for this...
declare @.strsql nvarchar(200)
declare @.result int
set @.strsql = 'exec @.result = master..xp_cmdshell '+"'"+' dir
c:\test\'+@.foldername +
+"'"+' , no_output'
exec sp_executesql @.strsql, '@.Result int OUTPUT', @.Result OUTPUT
print @.result
--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"mat" <mat@.discussions.microsoft.com> wrote in message
news:ADCB55FF-0912-4AFA-9747-BAEF494F6CAD@.microsoft.com...
> i'm trying to build up the following dynamically
> EXEC @.result =master..xp_cmdshell 'dir c:\test\D0004' , no_output
> print @.result
> so far i have got this..
> set @.strsql = 'exec master..xp_cmdshell '+"'"+' dir c:\test\'+@.foldername
+
> +"'"+' , no_output'
> exec(strsql)
> this work fine to execute, but i cannot find anyway of returning the
> success/failure into the variable @.result
> Please help|||Thanks, I'm running this and butt i'm getting the error message
Server: Msg 214, Level 16, State 3, Procedure sp_executesql, Line 38
Procedure expects parameter '@.parameters' of type 'ntext/nchar/nvarchar'.
"Adam Machanic" wrote:
> You can use sp_executesql with an output parameter for this...
> declare @.strsql nvarchar(200)
> declare @.result int
> set @.strsql = 'exec @.result = master..xp_cmdshell '+"'"+' dir
> c:\test\'+@.foldername +
> +"'"+' , no_output'
> exec sp_executesql @.strsql, '@.Result int OUTPUT', @.Result OUTPUT
> print @.result
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
> "mat" <mat@.discussions.microsoft.com> wrote in message
> news:ADCB55FF-0912-4AFA-9747-BAEF494F6CAD@.microsoft.com...
> > i'm trying to build up the following dynamically
> > EXEC @.result =master..xp_cmdshell 'dir c:\test\D0004' , no_output
> > print @.result
> >
> > so far i have got this..
> >
> > set @.strsql = 'exec master..xp_cmdshell '+"'"+' dir c:\test\'+@.foldername
> +
> > +"'"+' , no_output'
> >
> > exec(strsql)
> >
> > this work fine to execute, but i cannot find anyway of returning the
> > success/failure into the variable @.result
> >
> > Please help
>
>|||Should have used the 'national' designator for the @.parameters string
literal:
exec sp_executesql @.strsql, N'@.Result int OUTPUT', @.Result OUTPUT
That tells SQL Server that the string is Unicode.
--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Mat" <Mat@.discussions.microsoft.com> wrote in message
news:02ACC243-14F2-4A23-A5E4-C88CFE09EF74@.microsoft.com...
> Thanks, I'm running this and butt i'm getting the error message
> Server: Msg 214, Level 16, State 3, Procedure sp_executesql, Line 38
> Procedure expects parameter '@.parameters' of type 'ntext/nchar/nvarchar'.
> "Adam Machanic" wrote:
> > You can use sp_executesql with an output parameter for this...
> >
> > declare @.strsql nvarchar(200)
> > declare @.result int
> >
> > set @.strsql = 'exec @.result = master..xp_cmdshell '+"'"+' dir
> > c:\test\'+@.foldername +
> > +"'"+' , no_output'
> >
> > exec sp_executesql @.strsql, '@.Result int OUTPUT', @.Result OUTPUT
> >
> > print @.result
> >
> > --
> > Adam Machanic
> > SQL Server MVP
> > http://www.sqljunkies.com/weblog/amachanic
> > --
> >
> >
> > "mat" <mat@.discussions.microsoft.com> wrote in message
> > news:ADCB55FF-0912-4AFA-9747-BAEF494F6CAD@.microsoft.com...
> > > i'm trying to build up the following dynamically
> > > EXEC @.result =master..xp_cmdshell 'dir c:\test\D0004' , no_output
> > > print @.result
> > >
> > > so far i have got this..
> > >
> > > set @.strsql = 'exec master..xp_cmdshell '+"'"+' dir
c:\test\'+@.foldername
> > +
> > > +"'"+' , no_output'
> > >
> > > exec(strsql)
> > >
> > > this work fine to execute, but i cannot find anyway of returning the
> > > success/failure into the variable @.result
> > >
> > > Please help
> >
> >
> >