Showing posts with label specific. Show all posts
Showing posts with label specific. Show all posts

Tuesday, March 27, 2012

Creating a view to retrieve data from more than one database sql server 2000

Hi everyone,

we have some reference tables in in a specific database. that other applications need to have access to them. Is it possible to create a view in the application's database to retrive data from ref database while users just have access to the application Database not the view's underlying tables?

Thanks

Have a look at the topic Crossdatabase Ownership chain. It only possible under certain circumstances, the ownership chain cannot be broken.

Jens K. Suessmeyer

http://www.sqlserver2005.de

creating a user with dbo access

Hi,

I need to create a user with dbo access to a specific database using sql. I created a login and added a user to the login. How do i grant dbo privilege to this user (using sql)? Is there any system stored procedure for this? Please help.

Thanks in advance

Hi. Try

sp_changeowner [@.loginame=]'login'

Changes the owner of the current database.

sql

Wednesday, March 21, 2012

Creating a SQL Database File in a Specific Location

In SQL Server 9.0 (Standard Edition), I want to create a database from within
the Management Studio. But when I create it, I don't seem to have any control
of WHERE the actual database files are placed. I *must* be able to control
that somewhere, right?
Alex
Hi Alex
I presume you are using the New Database Dialog in Management Studio. In the
box where you supply the db name, you also supply all the details about each
of the files, including their physical location. When you scroll to the
right, you can see the text boxes for the path, and there is a button to
click to allow you to browse and choose a different path than the default.
HTH
Kalen Delaney, SQL Server MVP
http://sqlblog.com
"Alex Maghen" <AlexMaghen@.newsgroup.nospam> wrote in message
news:EB0663C5-18DF-4ECB-8D43-3C36E6263CB9@.microsoft.com...
> In SQL Server 9.0 (Standard Edition), I want to create a database from
> within
> the Management Studio. But when I create it, I don't seem to have any
> control
> of WHERE the actual database files are placed. I *must* be able to control
> that somewhere, right?
> Alex
|||Alex
Yes you can specify the database file location
General-> under Database file(move the scroll bar right) section
VT
"Alex Maghen" <AlexMaghen@.newsgroup.nospam> wrote in message
news:EB0663C5-18DF-4ECB-8D43-3C36E6263CB9@.microsoft.com...
> In SQL Server 9.0 (Standard Edition), I want to create a database from
> within
> the Management Studio. But when I create it, I don't seem to have any
> control
> of WHERE the actual database files are placed. I *must* be able to control
> that somewhere, right?
> Alex
|||In SQL Server Management Studio on the General page for creating a new
database you can expand the window or scroll to the right to see the Path
field. This is where you change the default location of the database files.
Regards,
Plamen Ratchev
http://www.SQLStudio.com
"Alex Maghen" <AlexMaghen@.newsgroup.nospam> wrote in message
news:EB0663C5-18DF-4ECB-8D43-3C36E6263CB9@.microsoft.com...
> In SQL Server 9.0 (Standard Edition), I want to create a database from
> within
> the Management Studio. But when I create it, I don't seem to have any
> control
> of WHERE the actual database files are placed. I *must* be able to control
> that somewhere, right?
> Alex
|||Yeah, OOPS. Just found that Thanks.
"Kalen Delaney" wrote:

> Hi Alex
> I presume you are using the New Database Dialog in Management Studio. In the
> box where you supply the db name, you also supply all the details about each
> of the files, including their physical location. When you scroll to the
> right, you can see the text boxes for the path, and there is a button to
> click to allow you to browse and choose a different path than the default.
> --
> HTH
> Kalen Delaney, SQL Server MVP
> http://sqlblog.com
>
> "Alex Maghen" <AlexMaghen@.newsgroup.nospam> wrote in message
> news:EB0663C5-18DF-4ECB-8D43-3C36E6263CB9@.microsoft.com...
>
>

Creating a SQL Database File in a Specific Location

In SQL Server 9.0 (Standard Edition), I want to create a database from withi
n
the Management Studio. But when I create it, I don't seem to have any contro
l
of WHERE the actual database files are placed. I *must* be able to control
that somewhere, right?
AlexHi Alex
I presume you are using the New Database Dialog in Management Studio. In the
box where you supply the db name, you also supply all the details about each
of the files, including their physical location. When you scroll to the
right, you can see the text boxes for the path, and there is a button to
click to allow you to browse and choose a different path than the default.
HTH
Kalen Delaney, SQL Server MVP
http://sqlblog.com
"Alex Maghen" <AlexMaghen@.newsgroup.nospam> wrote in message
news:EB0663C5-18DF-4ECB-8D43-3C36E6263CB9@.microsoft.com...
> In SQL Server 9.0 (Standard Edition), I want to create a database from
> within
> the Management Studio. But when I create it, I don't seem to have any
> control
> of WHERE the actual database files are placed. I *must* be able to control
> that somewhere, right?
> Alex|||Alex
Yes you can specify the database file location
General-> under Database file(move the scroll bar right) section
VT
"Alex Maghen" <AlexMaghen@.newsgroup.nospam> wrote in message
news:EB0663C5-18DF-4ECB-8D43-3C36E6263CB9@.microsoft.com...
> In SQL Server 9.0 (Standard Edition), I want to create a database from
> within
> the Management Studio. But when I create it, I don't seem to have any
> control
> of WHERE the actual database files are placed. I *must* be able to control
> that somewhere, right?
> Alex|||In SQL Server Management Studio on the General page for creating a new
database you can expand the window or scroll to the right to see the Path
field. This is where you change the default location of the database files.
Regards,
Plamen Ratchev
http://www.SQLStudio.com
"Alex Maghen" <AlexMaghen@.newsgroup.nospam> wrote in message
news:EB0663C5-18DF-4ECB-8D43-3C36E6263CB9@.microsoft.com...
> In SQL Server 9.0 (Standard Edition), I want to create a database from
> within
> the Management Studio. But when I create it, I don't seem to have any
> control
> of WHERE the actual database files are placed. I *must* be able to control
> that somewhere, right?
> Alex|||Yeah, OOPS. Just found that Thanks.
"Kalen Delaney" wrote:

> Hi Alex
> I presume you are using the New Database Dialog in Management Studio. In t
he
> box where you supply the db name, you also supply all the details about ea
ch
> of the files, including their physical location. When you scroll to the
> right, you can see the text boxes for the path, and there is a button to
> click to allow you to browse and choose a different path than the default.
> --
> HTH
> Kalen Delaney, SQL Server MVP
> http://sqlblog.com
>
> "Alex Maghen" <AlexMaghen@.newsgroup.nospam> wrote in message
> news:EB0663C5-18DF-4ECB-8D43-3C36E6263CB9@.microsoft.com...
>
>

Sunday, March 11, 2012

Creating a new measure that only sums data in specific part of cube

I have a cube with about 6 dimensions but only two are important right now. My main fact table is called MRSTATS. The dimension tables are Dim_Client#, and Dim_Test. I would like a measure called HospVol that only aggregates rows where MRSTATS.[Client#]=2. Then I need a measure called HospRVU that multiplies HospVol Measure by Dim_test.RVU. How do I got about configuring this?

Let me know if you need more information or if i'm going at this the wrong way. These values will be used in an SSRS report. Thank you very much.

I'm a little unclear on how you intend to set up your query, so my example may not be quite what you are looking for. Anyway, here is a sample query for AdventureWorks. I've broken down the calculations to make this easier to read:

Code Snippet

withmember [Measures].[Reseller Sales Amount Bikes] as

([Measures].[Reseller Sales Amount],[Product].[Category].[Category].[Bikes])

member [Measures].[List Price] as

IIF(

[Product].[List Price].CurrentMember.MemberValue=0,

NULL,

[Product].[List Price].CurrentMember.MemberValue)

member [Measures].[Bikes Sold] as

[Measures].[Reseller Sales Amount Bikes] /

[Measures].[List Price], format="#,#"

select

{

[Measures].[Reseller Sales Amount],

[Measures].[Reseller Sales Amount Bikes],

[Measures].[List Price],

[Measures].[Bikes Sold]

} on 0,

NONEMPTY [Product].[Product].[Product].Memberson 1

from [Adventure Works]

|||

To clarify things a little bit this is for labratory testing and Dim_Section is the section of the lab where the test was performed, Dim_Test is a table of the different tests and their various billing codes. Dim_Client# is a table of different Clients who we do testing for.

Alright the rows in my table in SSRS is going to be based on members of my Dim_Section Table and then my Dim_Test table and the columns are going to be attributes of the Dim_Test table as well as a few measure groups.

The only measure I have now is Volume which is a sum of the my item_qty field. I want a measure called HospVol which is the summation of the item_qty when the client# = 2 and all so a OtherVol for rows where client# !=2

I have done no work with MDX query text just the BI SSAS interface in SQL2005.

|||

Take a look at this code. The main thing to look at are the expressions at the top. Don't get too concerned with rows and columns just yet. SSRS will "flatten" your queries so that you establish the structure in the report. Main thing is to get the formulas right for you needs.

I wrote these samples against the AdventureWorks sample SSAS OLAP database. I'd recommend working with that database a bit to get comfortable with these concepts before applying them to your cubes.

Good Luck,
Bryan

Code Snippet

withmember [Measures].[Reseller Sales Amount Bikes] as

([Measures].[Reseller Sales Amount],[Product].[Category].[Category].[Bikes])

member [Measures].[Reseller Sales Amount Not Bikes] as

AGGREGATE(

EXCEPT(

[Product].[Category].[Category].Members,

[Product].[Category].[Category].[Bikes]

),

[Measures].[Reseller Sales Amount]

)

select

{

[Measures].[Reseller Sales Amount],

[Measures].[Reseller Sales Amount Bikes],

[Measures].[Reseller Sales Amount Not Bikes]

} on 0,

NONEMPTY [Date].[Calendar].[Calendar Year].Memberson 1

from [Adventure Works]

|||

Is there a way to set up my intended measure inside Business Intelligence SSAS without using MDX?

Otherwise could you give me a little insight on what the MDX code is actually used for? Is the MDX code used in building a cube and if so where can i edit the MDX code of the cube. Or is MDX used to run queries against the cube?

This is sort of what I get out of the above query: It sets up two new measures based on one existing measure. I dont know what 'on 0' means at the end of the select statement. The query uses the three measures and aggregates each for each year in the database. (Again, i dont know what 'on 1' means) and then [Adventure Works] is probably the cube name?

Could you direct me to a webpage about MDX?

Thanks for your help and patience.

|||

So, MDX is used for two things: defining expressions and assembling cell sets. The WITH MEMBER portions at the top of the sample are the expression approach. The SELECT ... FROM portion of the sample are the cell set construction part.

The SELECT stuff is only used when building queries. In cube design, you won't take advantage of this stuff. So, if the "on 0" and "on 1" stuff don't make a lot of sense, that's OK for now.

The WITH MEMBER stuff is the foundation for the MDX you would embedded in your cube as calculated members. Take a look at Books Online for topic "CREATE MEMBER statement".

I'm not aware of any books that cover MDX really deep. You may want to browse some of the books on SSAS as they should all cover calculated members and some basic MDX queries.

The best MDX learning resource I've found is this class http://www.hitachiconsulting.com/page.cfm?ID=trainingHandsOnMDXQueries. The schedule for the class is available at http://www.hitachiconsulting.com/page.cfm?ID=trainingSchedule and you would just need to click the email link at the bottom of the page to get the details on how to register. BTW, I need to disclose I work for Hitachi Consulting, the company providing this course.

Good luck,
Bryan

|||

So I think i've found the direction I need to go with this. I think I need to be making a caluculated member to do the aggregations I need. So this is the MDX I have right now based on the example you provided and some templates I found.

Code Snippet

CREATEMEMBERCURRENTCUBE.[MEASURES].[HospVol]

ASAGGREGATE

(

EXCEPT

(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]

),

[Measures].[Item Qty]

)

FORMAT_STRING = "Standard";

The error I'm getting right now is "Error 1 Query (4, 1) Parser: The syntax for 'CREATE' is incorrect. 0 0"

How does this look to you? Thank you so much for your assistance.

|||

For anyone else looking for MDX documentation, here it is:

http://msdn2.microsoft.com/en-us/library/ms145506(SQL.90).aspx

|||

It looks like in the EXCEPT function you are trying to return all the members of your Dim Client dimension's Dim Client hierarchy except the member with a key of 2. Is that correct?

By executing the MEMBERS function against the hierarchy without specifiying the level, you will get the ALL member in your list. So, I would recommend using [Dim Client #].[Dim Client#].[Dim Client#].Members instead to return just the leaf level members and not the ALL level member.

Regarding the error, I don't know exactly what's going on with that. I would recommend creating the calculated member using the form- view of the Cube Designer's Calculations tab. This will help you get the overall syntax correct.

In the form view, you will need to give the calculated member a name, [HospVol]. (Be sure to include the brackets.)

You will need to identify it's parent hierarchy. In this case, select MEASURES.

Next, enter your expression: AGGREGATE(EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2]),[Measures].[Item Qty])

Then, select your format string and visibility.

Finally, set the Non-Empty Behavior. This one is a little confusing but basically you identify a measure that when the measure is empty, the calculation is not performed. For this calculation, you can probably just ignore that.

Once you've set up the calculated member, just deploy your cube (you don't need to reprocess if the cube is already processed).

Good luck,
Bryan

|||

Hmm, I was going for nothing but Client# 2 so i'll have to look at that. It turns out that i'm going to need the except client# 2 so this one is still useful. I actually am using the form in the cube designer so thats probably why it was giving me the error with the create member.

I put in your expression and it evaluated but the aggregations are wrong because the values are higher than that of the total volume. I have confirmed that [Volume] has correct values so it must be a problem with the calculated member.

Here is my exact expression

Code Snippet

AGGREGATE(

EXCEPT(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]),

[Measures].[Volume])

Could it be a problem with how is aggregating? That should be based on [Volume] though correct?

If it clears up anything with the Client# dimension, there are to attributes, [Dim_Client#] and [Org Client]. There's not exactly much of a heirarchy going on.

Would the aggregation of just Client# 2 be:

Code Snippet

AGGREGATE(

FILTER(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]),

[Measures].[Volume])

This calculation takes a long time and returns blank cells. Maybe FILTER is the wrong keyword.

Am I going to run into any problems creating calculated members inside a non-measure dimension that multiply an measure by an attribute of the dimension?

Aside from this stuff, I think i'm pretty much ready to take this on by myself. Thanks for all your help

|||

Your expression needs to build a set of members and then cross join it to the measure of interest. This will generate a set of measure values associated with each member. That set can then be aggregated into a single value.

So, in the case where you want to get the set of all members that are NOT client key 2, the EXCEPT expression will give you that. If you want the set of just client 2, then just ask for that one member. Here is the set definition for each of these:

Code Snippet

EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2])

Code Snippet

[Dim Client#].[Dim Client#].&[2]

So, we have a set of members. Now we need to cross join this to the measure of interest, [Measures].[Volumes]. This will give us one measure value for each member in the set. If we have just one member in the set, SSAS can return just that one value. If we have multiple members, we need to aggregate those values to get a single, returnable value.

Code Snippet

AGGREGATE(EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2]),[Measures].[Volumes])

Code Snippet

([Dim Client#].[Dim Client#].&[2],[Measures].[Volumes])

As for the syntax problems, I'd kinda need to play with the cube to figure that one out. That's why we often use the WITH MEMBER syntax on a SELECT statement to get these things defined before moving them into the cube.

Anyway, hope that helps. Good luck.

Bryan

Creating a new measure that only sums data in specific part of cube

I have a cube with about 6 dimensions but only two are important right now. My main fact table is called MRSTATS. The dimension tables are Dim_Client#, and Dim_Test. I would like a measure called HospVol that only aggregates rows where MRSTATS.[Client#]=2. Then I need a measure called HospRVU that multiplies HospVol Measure by Dim_test.RVU. How do I got about configuring this?

Let me know if you need more information or if i'm going at this the wrong way. These values will be used in an SSRS report. Thank you very much.

I'm a little unclear on how you intend to set up your query, so my example may not be quite what you are looking for. Anyway, here is a sample query for AdventureWorks. I've broken down the calculations to make this easier to read:

Code Snippet

withmember [Measures].[Reseller Sales Amount Bikes] as

([Measures].[Reseller Sales Amount],[Product].[Category].[Category].[Bikes])

member [Measures].[List Price] as

IIF(

[Product].[List Price].CurrentMember.MemberValue=0,

NULL,

[Product].[List Price].CurrentMember.MemberValue)

member [Measures].[Bikes Sold] as

[Measures].[Reseller Sales Amount Bikes] /

[Measures].[List Price], format="#,#"

select

{

[Measures].[Reseller Sales Amount],

[Measures].[Reseller Sales Amount Bikes],

[Measures].[List Price],

[Measures].[Bikes Sold]

} on 0,

NONEMPTY [Product].[Product].[Product].Memberson 1

from [Adventure Works]

|||

To clarify things a little bit this is for labratory testing and Dim_Section is the section of the lab where the test was performed, Dim_Test is a table of the different tests and their various billing codes. Dim_Client# is a table of different Clients who we do testing for.

Alright the rows in my table in SSRS is going to be based on members of my Dim_Section Table and then my Dim_Test table and the columns are going to be attributes of the Dim_Test table as well as a few measure groups.

The only measure I have now is Volume which is a sum of the my item_qty field. I want a measure called HospVol which is the summation of the item_qty when the client# = 2 and all so a OtherVol for rows where client# !=2

I have done no work with MDX query text just the BI SSAS interface in SQL2005.

|||

Take a look at this code. The main thing to look at are the expressions at the top. Don't get too concerned with rows and columns just yet. SSRS will "flatten" your queries so that you establish the structure in the report. Main thing is to get the formulas right for you needs.

I wrote these samples against the AdventureWorks sample SSAS OLAP database. I'd recommend working with that database a bit to get comfortable with these concepts before applying them to your cubes.

Good Luck,
Bryan

Code Snippet

withmember [Measures].[Reseller Sales Amount Bikes] as

([Measures].[Reseller Sales Amount],[Product].[Category].[Category].[Bikes])

member [Measures].[Reseller Sales Amount Not Bikes] as

AGGREGATE(

EXCEPT(

[Product].[Category].[Category].Members,

[Product].[Category].[Category].[Bikes]

),

[Measures].[Reseller Sales Amount]

)

select

{

[Measures].[Reseller Sales Amount],

[Measures].[Reseller Sales Amount Bikes],

[Measures].[Reseller Sales Amount Not Bikes]

} on 0,

NONEMPTY [Date].[Calendar].[Calendar Year].Memberson 1

from [Adventure Works]

|||

Is there a way to set up my intended measure inside Business Intelligence SSAS without using MDX?

Otherwise could you give me a little insight on what the MDX code is actually used for? Is the MDX code used in building a cube and if so where can i edit the MDX code of the cube. Or is MDX used to run queries against the cube?

This is sort of what I get out of the above query: It sets up two new measures based on one existing measure. I dont know what 'on 0' means at the end of the select statement. The query uses the three measures and aggregates each for each year in the database. (Again, i dont know what 'on 1' means) and then [Adventure Works] is probably the cube name?

Could you direct me to a webpage about MDX?

Thanks for your help and patience.

|||

So, MDX is used for two things: defining expressions and assembling cell sets. The WITH MEMBER portions at the top of the sample are the expression approach. The SELECT ... FROM portion of the sample are the cell set construction part.

The SELECT stuff is only used when building queries. In cube design, you won't take advantage of this stuff. So, if the "on 0" and "on 1" stuff don't make a lot of sense, that's OK for now.

The WITH MEMBER stuff is the foundation for the MDX you would embedded in your cube as calculated members. Take a look at Books Online for topic "CREATE MEMBER statement".

I'm not aware of any books that cover MDX really deep. You may want to browse some of the books on SSAS as they should all cover calculated members and some basic MDX queries.

The best MDX learning resource I've found is this class http://www.hitachiconsulting.com/page.cfm?ID=trainingHandsOnMDXQueries. The schedule for the class is available at http://www.hitachiconsulting.com/page.cfm?ID=trainingSchedule and you would just need to click the email link at the bottom of the page to get the details on how to register. BTW, I need to disclose I work for Hitachi Consulting, the company providing this course.

Good luck,
Bryan

|||

So I think i've found the direction I need to go with this. I think I need to be making a caluculated member to do the aggregations I need. So this is the MDX I have right now based on the example you provided and some templates I found.

Code Snippet

CREATEMEMBERCURRENTCUBE.[MEASURES].[HospVol]

ASAGGREGATE

(

EXCEPT

(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]

),

[Measures].[Item Qty]

)

FORMAT_STRING = "Standard";

The error I'm getting right now is "Error 1 Query (4, 1) Parser: The syntax for 'CREATE' is incorrect. 0 0"

How does this look to you? Thank you so much for your assistance.

|||

For anyone else looking for MDX documentation, here it is:

http://msdn2.microsoft.com/en-us/library/ms145506(SQL.90).aspx

|||

It looks like in the EXCEPT function you are trying to return all the members of your Dim Client dimension's Dim Client hierarchy except the member with a key of 2. Is that correct?

By executing the MEMBERS function against the hierarchy without specifiying the level, you will get the ALL member in your list. So, I would recommend using [Dim Client #].[Dim Client#].[Dim Client#].Members instead to return just the leaf level members and not the ALL level member.

Regarding the error, I don't know exactly what's going on with that. I would recommend creating the calculated member using the form- view of the Cube Designer's Calculations tab. This will help you get the overall syntax correct.

In the form view, you will need to give the calculated member a name, [HospVol]. (Be sure to include the brackets.)

You will need to identify it's parent hierarchy. In this case, select MEASURES.

Next, enter your expression: AGGREGATE(EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2]),[Measures].[Item Qty])

Then, select your format string and visibility.

Finally, set the Non-Empty Behavior. This one is a little confusing but basically you identify a measure that when the measure is empty, the calculation is not performed. For this calculation, you can probably just ignore that.

Once you've set up the calculated member, just deploy your cube (you don't need to reprocess if the cube is already processed).

Good luck,
Bryan

|||

Hmm, I was going for nothing but Client# 2 so i'll have to look at that. It turns out that i'm going to need the except client# 2 so this one is still useful. I actually am using the form in the cube designer so thats probably why it was giving me the error with the create member.

I put in your expression and it evaluated but the aggregations are wrong because the values are higher than that of the total volume. I have confirmed that [Volume] has correct values so it must be a problem with the calculated member.

Here is my exact expression

Code Snippet

AGGREGATE(

EXCEPT(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]),

[Measures].[Volume])

Could it be a problem with how is aggregating? That should be based on [Volume] though correct?

If it clears up anything with the Client# dimension, there are to attributes, [Dim_Client#] and [Org Client]. There's not exactly much of a heirarchy going on.

Would the aggregation of just Client# 2 be:

Code Snippet

AGGREGATE(

FILTER(

[Dim Client#].[Dim Client#].Members,

[Dim Client#].[Dim Client#].&[2]),

[Measures].[Volume])

This calculation takes a long time and returns blank cells. Maybe FILTER is the wrong keyword.

Am I going to run into any problems creating calculated members inside a non-measure dimension that multiply an measure by an attribute of the dimension?

Aside from this stuff, I think i'm pretty much ready to take this on by myself. Thanks for all your help

|||

Your expression needs to build a set of members and then cross join it to the measure of interest. This will generate a set of measure values associated with each member. That set can then be aggregated into a single value.

So, in the case where you want to get the set of all members that are NOT client key 2, the EXCEPT expression will give you that. If you want the set of just client 2, then just ask for that one member. Here is the set definition for each of these:

Code Snippet

EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2])

Code Snippet

[Dim Client#].[Dim Client#].&[2]

So, we have a set of members. Now we need to cross join this to the measure of interest, [Measures].[Volumes]. This will give us one measure value for each member in the set. If we have just one member in the set, SSAS can return just that one value. If we have multiple members, we need to aggregate those values to get a single, returnable value.

Code Snippet

AGGREGATE(EXCEPT([Dim Client#].[Dim Client#].Members,[Dim Client#].[Dim Client#].&[2]),[Measures].[Volumes])

Code Snippet

([Dim Client#].[Dim Client#].&[2],[Measures].[Volumes])

As for the syntax problems, I'd kinda need to play with the cube to figure that one out. That's why we often use the WITH MEMBER syntax on a SELECT statement to get these things defined before moving them into the cube.

Anyway, hope that helps. Good luck.

Bryan

Thursday, March 8, 2012

Creating a hyperlink within a report to access specific CRM screen

Does anybody know how to create a hyperlink within a report to access
specific CRM screen?
Thanks!Add a textbox control and in the Navigation properties tab specify the Jump
to URL which will accept expressions with data fields.
Steve MunLeeuw
"Tony" <Tony@.discussions.microsoft.com> wrote in message
news:B453C371-8CA3-47CD-83CF-73E3BDC7FB6C@.microsoft.com...
> Does anybody know how to create a hyperlink within a report to access
> specific CRM screen?
> Thanks!

Saturday, February 25, 2012

Creating a Database from multiple databases accross multiple servers

Hi,

I'm trying to create a database that takes specific information from a number of databases on different servers to make some reporting that we have much easier.

I'm pretty new to SQL so I'm not sure of the best way to proceed. I read an article that suggested I use the OPENROWSET command. The problem is, the version of SQL that came with one of the programmes we use is limited and will not allow you to turn on the allow "Ad Hoc distributed Queries" so the SLQ statement will not execute.

I'm confused why it won't let me to connect through ODBC as I've created a web page that selects data from this database with no problems!

Here is the SQL statement that I've written to make sure it is the correct one (on the msdn library page it said that this was the ODBC connection):

SELECT a.*
FROM OPENROWSET('MSDASQL','DRIVER=(SQL Server);SERVER=APPOLO\ACT7;UID=sa;PWD=***************',
'SELECT * FROM MDCTestAndDev.dbo.TBL_CONTACT') AS a

I've also created the ODBC connection using the tool on Administration Tools>Data Sources ODBC

Any help would be greatly appreciated (also any ways of selecting from one database and inserting it into another will be helpfull)

Thanks

Which version of SQL Server your using (2000 or 2005)?|||Hi I'm using the Express 2005 Edition|||

'ad-hoc dist' property controls whether or not the use of OpenRowset/Datasource is allowed. If it's not enabled, you will not be able to execute the query, regardless of the data access provider you use.

Your only option is to create a linked server and use OpenQuery() or 4-part name query.

http://msdn2.microsoft.com/en-us/library/ms190479.aspx

|||

Thanks for the reply

I have managed to create a linked server using the following bit of code:

Code Snippet

EXEC sp_addlinkedserver

@.server = 'APPOLO/ACT7',

@.srvproduct = 'SQLServr OLEDB Provider',

@.provider = 'MSDASQL',

@.datasrc='ACT7'

GO

I then created and ran the following statement:

Code Snippet

SELECT *

FROM OPENQUERY(APPOLO/ACT, 'SELECT * FROM mdc1.TBL_CONTACTS')

I then get the following error message:

"Incorrect Syntac near '/'"

I have tried only using "APPOLO", "ACT7", "APPOLO.ACT7" and putting them all in quotation marks but it does not work.

Any Ideas?

|||How about:

[APPOLO/ACT]

HTH!|||

Great - that solved that problem -

I'm now getting a message to say that authentication failed - I guess this is because I havent provided the sa password - how do i enter this so that I can connect?

Thanks

Tom

|||

You use this to set the login.

Code Snippet

EXEC sp_addlinkedsrvlogin 'APPOLO/ACT', 'false', NULL, 'sa', 'Password'

Creating a Database from multiple databases accross multiple servers

Hi,

I'm trying to create a database that takes specific information from a number of databases on different servers to make some reporting that we have much easier.

I'm pretty new to SQL so I'm not sure of the best way to proceed. I read an article that suggested I use the OPENROWSET command. The problem is, the version of SQL that came with one of the programmes we use is limited and will not allow you to turn on the allow "Ad Hoc distributed Queries" so the SLQ statement will not execute.

I'm confused why it won't let me to connect through ODBC as I've created a web page that selects data from this database with no problems!

Here is the SQL statement that I've written to make sure it is the correct one (on the msdn library page it said that this was the ODBC connection):

SELECT a.*
FROM OPENROWSET('MSDASQL','DRIVER=(SQL Server);SERVER=APPOLO\ACT7;UID=sa;PWD=***************',
'SELECT * FROM MDCTestAndDev.dbo.TBL_CONTACT') AS a

I've also created the ODBC connection using the tool on Administration Tools>Data Sources ODBC

Any help would be greatly appreciated (also any ways of selecting from one database and inserting it into another will be helpfull)

Thanks

Which version of SQL Server your using (2000 or 2005)?|||Hi I'm using the Express 2005 Edition|||

'ad-hoc dist' property controls whether or not the use of OpenRowset/Datasource is allowed. If it's not enabled, you will not be able to execute the query, regardless of the data access provider you use.

Your only option is to create a linked server and use OpenQuery() or 4-part name query.

http://msdn2.microsoft.com/en-us/library/ms190479.aspx

|||

Thanks for the reply

I have managed to create a linked server using the following bit of code:

Code Snippet

EXEC sp_addlinkedserver

@.server = 'APPOLO/ACT7',

@.srvproduct = 'SQLServr OLEDB Provider',

@.provider = 'MSDASQL',

@.datasrc='ACT7'

GO

I then created and ran the following statement:

Code Snippet

SELECT *

FROM OPENQUERY(APPOLO/ACT, 'SELECT * FROM mdc1.TBL_CONTACTS')

I then get the following error message:

"Incorrect Syntac near '/'"

I have tried only using "APPOLO", "ACT7", "APPOLO.ACT7" and putting them all in quotation marks but it does not work.

Any Ideas?

|||How about:

[APPOLO/ACT]

HTH!|||

Great - that solved that problem -

I'm now getting a message to say that authentication failed - I guess this is because I havent provided the sa password - how do i enter this so that I can connect?

Thanks

Tom

|||

You use this to set the login.

Code Snippet

EXEC sp_addlinkedsrvlogin 'APPOLO/ACT', 'false', NULL, 'sa', 'Password'

Friday, February 24, 2012

Creating a column.

Is there a way for me to create a column in SQL?

What Im looking to do is create a view with columns from a specific table. In addition to this I would like to append a column to the view which would contain data based on the data from a pre-existing column.

Table A
Column 1
Column 2
Column 3

View A
Column 1
Column 2
Column 3
Column 4

Now here is the Row structure

Column 1 Column 2 Column 3 Column 4
Test Test A ON
Test Test B OFF

So if Column 3 contains "A" as its field data than Column 4 will contain "ON" and if Column 3 contains "B" than Column 4 will contain "OFF"

Is this possible?

TIA,

Stue.

SELECT Col1,Col2,Col3, Case Col3 When 'A' Then 'ON' Else 'OFF' End From tbl_YourTable

|||

This is definitely possible, use something like the select statement below to create the view:

SELECT Column1, Column2, Column3, Column4 =CASE Column3WHEN'A'THEN'ON'ELSE'OFF'ENDFROM TableA ...
I haven't worked with SQL Server Express so I don't know if CASE is supported. You could alternatively use temp tables etc, but the above statement is probably the least TSQL-intensive. 
|||

Thanks guys!

Just what I needed!

Stue

|||

Chris Pebble:

I haven't worked with SQL Server Express so I don't know if CASE is supported. You could alternatively use temp tables etc, but the above statement is probably the least TSQL-intensive. 

Chris,

As a FYI to you and others that may have the same question... CASE is supported. I am using this code on a Express server.

Thanks again,

Stue

Sunday, February 19, 2012

CreateSubscription service creates all the subscriptions as ASPNET user

I have a custom form which users can use to create subscriptions for specific
reprots. I am able to create subscriptions just fine but my issue is that all
the subscriptions are created as ASPNET user. Am I missing something in the
setup?
Thanks for your help.
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200508/1Hi,
Do you use Windows NT Authentication or anonymous access is enabled?
"akhan via SQLMonster.com" wrote:
> I have a custom form which users can use to create subscriptions for specific
> reprots. I am able to create subscriptions just fine but my issue is that all
> the subscriptions are created as ASPNET user. Am I missing something in the
> setup?
> Thanks for your help.
>
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200508/1
>|||I am using Windows Authentication.
eralper wrote:
>Hi,
>Do you use Windows NT Authentication or anonymous access is enabled?
>> I have a custom form which users can use to create subscriptions for specific
>> reprots. I am able to create subscriptions just fine but my issue is that all
>> the subscriptions are created as ASPNET user. Am I missing something in the
>> setup?
>> Thanks for your help.
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200508/1