Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Thursday, March 29, 2012

Credentials problem or deployment puzzle or permission problem?

Hi,All:

I had development a reporting service home page for our intranet . And I deployed this home page at "domain.server1" (for example) and my sql server database and reporting service is at another server "domain.server2"(for example). on the "domain.server1" , the Authentication methods is Integrated windows authentication. and on the "domain.server2" , with the reportingservice server properites and home folder, in the "permissions" tab, I had add the "domain.server1$" as system user role. so I can view my report via my home page and it works fine. If I remove the "domain.server1$" from the reporting service, there could be encountered an error "The permissions granted to user 'domain.server1$' are insufficient for performing this operation".

I used

rService.Credentials = System.Net.CredentialCache.DefaultCredentials;

in my home page to list the reports. I think this must be a problem, so I change this code as

System.Net.NetworkCredential myCreds = new System.Net.NetworkCredential();
myCreds.Domain = "domain";
myCreds.UserName = "UserName";
myCreds.Password = "Password";
rService.Credentials = myCreds;

and add this "UserName" to a local group "group1" on "domain.server2" , and grant this group "group1" to access the reporting service server. It works fine.

but now , I'm confused how to get the user's information (especially the password infomation , even though encrypted )?

Does any one can give me some feedbacks?

T.I.A

henry

http://blogs.msdn.com/bimusings/archive/2005/11/18/494436.aspx?CommentPosted=true#commentmessage

I got the this scenarios a few days ago, after a few day's research.

I found that we must configurate the webServer as a trusted server so it can pass the credentials to the SSRS.

Allow a computer to be trusted for delegation

http://technet2.microsoft.com/WindowsServer/en/library/b207ee9c-a055-43f7-b9be-20599b694a311033.mspx?mfr=true

in the web applcation , we just set the Report viewer control credential like this:

rService.Credentials = System.Net.CredentialCache.DefaultCredentials;

we must configurate the webServer to support the Kerberos Authentication and Delegation

How to configure IIS to support both the Kerberos protocol and the NTLM protocol for network authentication

http://support.microsoft.com/kb/215383

and It works.

Good luck!

Henry

Credentials problem or deployment puzzle or permission problem?

Hi,All:

I had development a reporting service home page for our intranet . And I deployed this home page at "domain.server1" (for example) and my sql server database and reporting service is at another server "domain.server2"(for example). on the "domain.server1" , the Authentication methods is Integrated windows authentication. and on the "domain.server2" , with the reportingservice server properites and home folder, in the "permissions" tab, I had add the "domain.server1$" as system user role. so I can view my report via my home page and it works fine. If I remove the "domain.server1$" from the reporting service, there could be encountered an error "The permissions granted to user 'domain.server1$' are insufficient for performing this operation".

I used

rService.Credentials = System.Net.CredentialCache.DefaultCredentials;

in my home page to list the reports. I think this must be a problem, so I change this code as

System.Net.NetworkCredential myCreds = new System.Net.NetworkCredential();
myCreds.Domain = "domain";
myCreds.UserName = "UserName";
myCreds.Password = "Password";
rService.Credentials = myCreds;

and add this "UserName" to a local group "group1" on "domain.server2" , and grant this group "group1" to access the reporting service server. It works fine.

but now , I'm confused how to get the user's information (especially the password infomation , even though encrypted )?

Does any one can give me some feedbacks?

T.I.A

henry

http://blogs.msdn.com/bimusings/archive/2005/11/18/494436.aspx?CommentPosted=true#commentmessage

I got the this scenarios a few days ago, after a few day's research.

I found that we must configurate the webServer as a trusted server so it can pass the credentials to the SSRS.

Allow a computer to be trusted for delegation

http://technet2.microsoft.com/WindowsServer/en/library/b207ee9c-a055-43f7-b9be-20599b694a311033.mspx?mfr=true

in the web applcation , we just set the Report viewer control credential like this:

rService.Credentials = System.Net.CredentialCache.DefaultCredentials;

we must configurate the webServer to support the Kerberos Authentication and Delegation

How to configure IIS to support both the Kerberos protocol and the NTLM protocol for network authentication

http://support.microsoft.com/kb/215383

and It works.

Good luck!

Henry

Tuesday, March 27, 2012

creating views in mssql

hey guys,
can you share an example of how I can create views in MSSQL where the table
is stored in oarcle server.
thanks guys.
neil
Hi,
For that you have to create a linked server to the Oracle server.
see this link to get info on creating linked Server to ORACLE
http://support.microsoft.com/default...b;EN-US;280106
After that create the view from sql server .
Sample:
EXEC sp_addlinkedserver 'OracleSvr',
'Oracle 7.3',
'MSDAORA',
'ORCLDB'
GO
SELECT *
FROM OPENQUERY(OracleSvr, 'SELECT name, id FROM joe.titles')
GO
Thanks
Hari
MCDBA
"Neil" <neil-on-ht@.restricted.dyndns.org> wrote in message
news:O0gAwMYqEHA.2696@.TK2MSFTNGP15.phx.gbl...
> hey guys,
> can you share an example of how I can create views in MSSQL where the
> table is stored in oarcle server.
> thanks guys.
> neil
>
|||Hi Hari,
Thanks for the link. I'm gonna try it tomorrow.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:eEf6BjYqEHA.2636@.TK2MSFTNGP09.phx.gbl...
> Hi,
> For that you have to create a linked server to the Oracle server.
> see this link to get info on creating linked Server to ORACLE
> http://support.microsoft.com/default...b;EN-US;280106
> After that create the view from sql server .
> Sample:
> EXEC sp_addlinkedserver 'OracleSvr',
> 'Oracle 7.3',
> 'MSDAORA',
> 'ORCLDB'
> GO
> SELECT *
> FROM OPENQUERY(OracleSvr, 'SELECT name, id FROM joe.titles')
> GO
>
> Thanks
> Hari
> MCDBA
> "Neil" <neil-on-ht@.restricted.dyndns.org> wrote in message
> news:O0gAwMYqEHA.2696@.TK2MSFTNGP15.phx.gbl...
>

creating views in mssql

hey guys,
can you share an example of how I can create views in MSSQL where the table
is stored in oarcle server.
thanks guys.
neilHi,
For that you have to create a linked server to the Oracle server.
see this link to get info on creating linked Server to ORACLE
http://support.microsoft.com/default.aspx?scid=kb;EN-US;280106
After that create the view from sql server .
Sample:
EXEC sp_addlinkedserver 'OracleSvr',
'Oracle 7.3',
'MSDAORA',
'ORCLDB'
GO
SELECT *
FROM OPENQUERY(OracleSvr, 'SELECT name, id FROM joe.titles')
GO
Thanks
Hari
MCDBA
"Neil" <neil-on-ht@.restricted.dyndns.org> wrote in message
news:O0gAwMYqEHA.2696@.TK2MSFTNGP15.phx.gbl...
> hey guys,
> can you share an example of how I can create views in MSSQL where the
> table is stored in oarcle server.
> thanks guys.
> neil
>|||Hi Hari,
Thanks for the link. I'm gonna try it tomorrow.
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:eEf6BjYqEHA.2636@.TK2MSFTNGP09.phx.gbl...
> Hi,
> For that you have to create a linked server to the Oracle server.
> see this link to get info on creating linked Server to ORACLE
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;280106
> After that create the view from sql server .
> Sample:
> EXEC sp_addlinkedserver 'OracleSvr',
> 'Oracle 7.3',
> 'MSDAORA',
> 'ORCLDB'
> GO
> SELECT *
> FROM OPENQUERY(OracleSvr, 'SELECT name, id FROM joe.titles')
> GO
>
> Thanks
> Hari
> MCDBA
> "Neil" <neil-on-ht@.restricted.dyndns.org> wrote in message
> news:O0gAwMYqEHA.2696@.TK2MSFTNGP15.phx.gbl...
>> hey guys,
>> can you share an example of how I can create views in MSSQL where the
>> table is stored in oarcle server.
>> thanks guys.
>> neil
>

Tuesday, March 20, 2012

Creating table daily

How can I create a table daily, whose name was the current date in the yy/mm/dd format plus the algarism to identify the weekday (for example Wednesday = 4), for instance if the query was run on 01/15/2003 (wednesday), the tabelname would be 3_01_15_4 ?Originally posted by cassianorsilva
How can I create a table daily, whose name was the current date in the yy/mm/dd format plus the algarism to identify the weekday (for example Wednesday = 4), for instance if the query was run on 01/15/2003 (wednesday), the tabelname would be 3_01_15_4 ?

declare @.date char(9)
set @.date = substring(convert(char(4),getdate(),121),4,1)+'_'+ substring(convert(char(7),getdate(),121),6,2)+'_'+ substring(convert(char(10),getdate(),121),9,2)
+'_'+cast(DATEPART(dw, GETDATE()) as char(1))|||Thank you !

The table creation is not included on the proceedure above, right ?|||Originally posted by cassianorsilva
Thank you !

The table creation is not included on the proceedure above, right ?

No it's not, once u have the string in the @.date variable, just concatenate that with ur tablename and use that string in ur table creation

says ur final tablename is in a variable @.tablename.

exec('Create table '+@.tablename)

Sumthin around those lines

Creating Stored Procedures Based On Variables

Hi There,

I would like to know if for example i have some tables in my DataBase and i need from each table to get for instance, the Name by the ID, how can i make only one procedure which use parameters and variables so i can use this SP to get the Name By ID for all the Tables?

Thanks

You would have to use dynamic SQL in the stored procedure. Assuming all you tables had a unique column named ID and an associated column named NAME, you could create a simple procedure like:
Create Procedure GetNameByID(

@.tableName varchar(100),

@.ID int

)

AS

Begin

Declare @.sql nvarchar(1000)

Set @.sql = N'Select "NAME" From ' + @.tableName + N' Where ID = ' + Convert( varchar(10), @.ID )

exec( @.sql )

End

go

exec GetNameByID 'sysobjects', 1

exec GetNameByID 'syscolumns', 1

And you could get more complicated from there.

Saturday, February 25, 2012

Creating Named Query in Analysis Services Using AMO

Hello,

Is there an example somewhere that shows how to create a named query in DSV based on an existing table in the DSV using AMO?

Thank you so much,

Sincerely,

Annie

This may help:

http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=727220&SiteID=17

Also, if you install the SQL Server Samples, the following path will have a bit of a more comprehensive example of creating a DSV. Though it doesn't create any named queries, it may be helpful:

C:\program files\Microsoft SQL Server\90\Samples\Analysis Services\Programmability\AMO\AMOAdventureWorks\CS\AmoAdventureWorks

Friday, February 24, 2012

Creating local cubes from relational sources using XMLA

Hi,

I have looked at Chris Webb′s example in creating local cubes. I′m trying to follow his instructions but I think that the syntax or the code is incorrect somehow.

Code Snippet

CREATE GLOBAL CUBE statement. FILENAME|C:\myCube.cub|DDL|

<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</Parallel>

Hello Inmon,

pleae visit the blog entry again and read again:

http://cwebbbi.spaces.live.com/blog/cns!7B84B0F2C239489A!883.entry

It is not possible to create a local cube from relational data with CREATE GLOBAL CUBE Syntax.

I got the sample running.

HTH

J?rg

|||

Hi J?rg,

Then I would be happy if you told me how you solved it.

This is the example I followed by Chris:

· Open MDX Sample app - yes, this is another one of those areas where SQLMS won't do the job. Connect to the Adventure Works database

· Paste a CREATE GLOBAL CUBE statement into a query pane. Don't run it yet though...

· Start a new Profiler trace on your target database

· Run the CREATE GLOBAL CUBE statement, then stop the trace

· Inside your trace, you'll see the CREATE GLOBAL CUBE statement appear twice followed by a statement which begins with something like this: "CREATE GLOBAL CUBE statement. FILENAME|c:\MyfileName.cub|DDL|" and is followed by an XMLA batch statement

· Copy the XMLA batch statement out to MDX Sample App (if you find you can't do this, you might need to save the trace as an XML file and open it in Notepad or something) and

· Close the connection to your server cube in MDX Sample app, then reconnect to the path you want to create your new cub file at, eg "c:\cubtest.cub" (instead of supplying the name of your server in the connection dialog box).

· Run the Batch statement, and your local cube is created!

|||

Hi Inmon,

this is the sample for relational datasources

In SSMS script the database you've just created to a new query editor window. Still in SSMS, right-click on the database again and select Process, select 'Process Full' then instead of clicking OK click the Script button and choose to script to a new query editor window. You now have the two XMLA commands you need to create and process your local cube, you just need to combine them into one. Select all of the Create statement generated when you scripted the database and paste it into the Batch statement generated from the Process dialog, immediately after the first line (containing the 'Batch' command) and before the XMLA that actually does the processing. Copy the new statement, open up MDX Sample app, connect to the path of the new local cube file, paste the statement into MDX Sample app and then run it. And voila, your local cube will be built direct from the relational data source.|||

Hi Joschko,

I have read that example too. Combine the two scripts into one is no problem but I can′t connect to the path of my local cube. When I connect to my local cube I connect to Analysis Services and writing c:\myCube.cub in the server name field. The .cub file creates but following message appear:

Code Snippet

TITLE: Microsoft SQL Server Management Studio

Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476


ADDITIONAL INFORMATION:

A connection cannot be made. Ensure that the server is running. (Microsoft.AnalysisServices.Xmla)

The 'c:\myCube.cub' local cube file cannot be opened. (Microsoft.AnalysisServices.Xmla)

The operation completed successfully (Microsoft.AnalysisServices.Xmla)

When I then run the script I recieve the following message:

Code Snippet

TITLE: Microsoft SQL Server Management Studio

Either the user, DOMAIN\userid, does not have access to the c:\myCube.cub database, or the database does not exist. (Microsoft SQL Server 2005 Analysis Services)

|||

Hi,

I have now succeeded with connect the script into one. Wpuld you like to confirm this?

<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</Parallel>
</Batch>

When I connect to my local cube through new query and select AS XMLA query and the run it I receive the following message:

Code Snippet

Executing the query ...

A connection cannot be made. Ensure that the server is running.

Execution complete

Regards,

Inmon

|||

Inmon,

I've just got the message you sent me via my blog, but I can't reply because you're communication settings won't allow me. Can you contact me directly please? You can find my contact details at www.crossjoin.co.uk

Chris

|||

I Chris,

You ought to have the email right now. But you can write down the detail instructions about local cubes here at msdn if you want to. Thanks again for you help.

Creating local cubes from relational sources using XMLA

Hi,

I have looked at Chris Webb′s example in creating local cubes. I′m trying to follow his instructions but I think that the syntax or the code is incorrect somehow.

Code Snippet

CREATE GLOBAL CUBE statement. FILENAME|C:\myCube.cub|DDL|

<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</Parallel>

Hello Inmon,

pleae visit the blog entry again and read again:

http://cwebbbi.spaces.live.com/blog/cns!7B84B0F2C239489A!883.entry

It is not possible to create a local cube from relational data with CREATE GLOBAL CUBE Syntax.

I got the sample running.

HTH

J?rg

|||

Hi J?rg,

Then I would be happy if you told me how you solved it.

This is the example I followed by Chris:

· Open MDX Sample app - yes, this is another one of those areas where SQLMS won't do the job. Connect to the Adventure Works database

· Paste a CREATE GLOBAL CUBE statement into a query pane. Don't run it yet though...

· Start a new Profiler trace on your target database

· Run the CREATE GLOBAL CUBE statement, then stop the trace

· Inside your trace, you'll see the CREATE GLOBAL CUBE statement appear twice followed by a statement which begins with something like this: "CREATE GLOBAL CUBE statement. FILENAME|c:\MyfileName.cub|DDL|" and is followed by an XMLA batch statement

· Copy the XMLA batch statement out to MDX Sample App (if you find you can't do this, you might need to save the trace as an XML file and open it in Notepad or something) and

· Close the connection to your server cube in MDX Sample app, then reconnect to the path you want to create your new cub file at, eg "c:\cubtest.cub" (instead of supplying the name of your server in the connection dialog box).

· Run the Batch statement, and your local cube is created!

|||

Hi Inmon,

this is the sample for relational datasources

In SSMS script the database you've just created to a new query editor window. Still in SSMS, right-click on the database again and select Process, select 'Process Full' then instead of clicking OK click the Script button and choose to script to a new query editor window. You now have the two XMLA commands you need to create and process your local cube, you just need to combine them into one. Select all of the Create statement generated when you scripted the database and paste it into the Batch statement generated from the Process dialog, immediately after the first line (containing the 'Batch' command) and before the XMLA that actually does the processing. Copy the new statement, open up MDX Sample app, connect to the path of the new local cube file, paste the statement into MDX Sample app and then run it. And voila, your local cube will be built direct from the relational data source.|||

Hi Joschko,

I have read that example too. Combine the two scripts into one is no problem but I can′t connect to the path of my local cube. When I connect to my local cube I connect to Analysis Services and writing c:\myCube.cub in the server name field. The .cub file creates but following message appear:

Code Snippet

TITLE: Microsoft SQL Server Management Studio

Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476


ADDITIONAL INFORMATION:

A connection cannot be made. Ensure that the server is running. (Microsoft.AnalysisServices.Xmla)

The 'c:\myCube.cub' local cube file cannot be opened. (Microsoft.AnalysisServices.Xmla)

The operation completed successfully (Microsoft.AnalysisServices.Xmla)

When I then run the script I recieve the following message:

Code Snippet

TITLE: Microsoft SQL Server Management Studio

Either the user, DOMAIN\userid, does not have access to the c:\myCube.cub database, or the database does not exist. (Microsoft SQL Server 2005 Analysis Services)

|||

Hi,

I have now succeeded with connect the script into one. Wpuld you like to confirm this?

<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</Parallel>
</Batch>

When I connect to my local cube through new query and select AS XMLA query and the run it I receive the following message:

Code Snippet

Executing the query ...

A connection cannot be made. Ensure that the server is running.

Execution complete

Regards,

Inmon

|||

Inmon,

I've just got the message you sent me via my blog, but I can't reply because you're communication settings won't allow me. Can you contact me directly please? You can find my contact details at www.crossjoin.co.uk

Chris

|||

I Chris,

You ought to have the email right now. But you can write down the detail instructions about local cubes here at msdn if you want to. Thanks again for you help.

Creating local cubes from relational sources using XMLA

Hi,

I have looked at Chris Webb′s example in creating local cubes. I′m trying to follow his instructions but I think that the syntax or the code is incorrect somehow.

Code Snippet

CREATE GLOBAL CUBE statement. FILENAME|C:\myCube.cub|DDL|

<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">

<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</Parallel>

Hello Inmon,

pleae visit the blog entry again and read again:

http://cwebbbi.spaces.live.com/blog/cns!7B84B0F2C239489A!883.entry

It is not possible to create a local cube from relational data with CREATE GLOBAL CUBE Syntax.

I got the sample running.

HTH

J?rg

|||

Hi J?rg,

Then I would be happy if you told me how you solved it.

This is the example I followed by Chris:

· Open MDX Sample app - yes, this is another one of those areas where SQLMS won't do the job. Connect to the Adventure Works database

· Paste a CREATE GLOBAL CUBE statement into a query pane. Don't run it yet though...

· Start a new Profiler trace on your target database

· Run the CREATE GLOBAL CUBE statement, then stop the trace

· Inside your trace, you'll see the CREATE GLOBAL CUBE statement appear twice followed by a statement which begins with something like this: "CREATE GLOBAL CUBE statement. FILENAME|c:\MyfileName.cub|DDL|" and is followed by an XMLA batch statement

· Copy the XMLA batch statement out to MDX Sample App (if you find you can't do this, you might need to save the trace as an XML file and open it in Notepad or something) and

· Close the connection to your server cube in MDX Sample app, then reconnect to the path you want to create your new cub file at, eg "c:\cubtest.cub" (instead of supplying the name of your server in the connection dialog box).

· Run the Batch statement, and your local cube is created!

|||

Hi Inmon,

this is the sample for relational datasources

In SSMS script the database you've just created to a new query editor window. Still in SSMS, right-click on the database again and select Process, select 'Process Full' then instead of clicking OK click the Script button and choose to script to a new query editor window. You now have the two XMLA commands you need to create and process your local cube, you just need to combine them into one. Select all of the Create statement generated when you scripted the database and paste it into the Batch statement generated from the Process dialog, immediately after the first line (containing the 'Batch' command) and before the XMLA that actually does the processing. Copy the new statement, open up MDX Sample app, connect to the path of the new local cube file, paste the statement into MDX Sample app and then run it. And voila, your local cube will be built direct from the relational data source.|||

Hi Joschko,

I have read that example too. Combine the two scripts into one is no problem but I can′t connect to the path of my local cube. When I connect to my local cube I connect to Analysis Services and writing c:\myCube.cub in the server name field. The .cub file creates but following message appear:

Code Snippet

TITLE: Microsoft SQL Server Management Studio

Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476


ADDITIONAL INFORMATION:

A connection cannot be made. Ensure that the server is running. (Microsoft.AnalysisServices.Xmla)

The 'c:\myCube.cub' local cube file cannot be opened. (Microsoft.AnalysisServices.Xmla)

The operation completed successfully (Microsoft.AnalysisServices.Xmla)

When I then run the script I recieve the following message:

Code Snippet

TITLE: Microsoft SQL Server Management Studio

Either the user, DOMAIN\userid, does not have access to the c:\myCube.cub database, or the database does not exist. (Microsoft SQL Server 2005 Analysis Services)

|||

Hi,

I have now succeeded with connect the script into one. Wpuld you like to confirm this?

<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</Parallel>
</Batch>

When I connect to my local cube through new query and select AS XMLA query and the run it I receive the following message:

Code Snippet

Executing the query ...

A connection cannot be made. Ensure that the server is running.

Execution complete

Regards,

Inmon

|||

Inmon,

I've just got the message you sent me via my blog, but I can't reply because you're communication settings won't allow me. Can you contact me directly please? You can find my contact details at www.crossjoin.co.uk

Chris

|||

I Chris,

You ought to have the email right now. But you can write down the detail instructions about local cubes here at msdn if you want to. Thanks again for you help.

Sunday, February 19, 2012

Creating Horizontal Partition

From a previous post I got an example of creating a Horizontal Partition. I have altered the code in an attempt to understand why the partition I want fails on insert. The altered script is:

create table Table_A_Jan (Col1 int not null, Col2 char(2) not null CHECK (col2 = 'RL')--CHECK (Col2 >= cast('20060101' as datetime) and Col2 < cast('20060201' as datetime))--,--Col3 char(5) not null, CONSTRAINT [PKJan] PRIMARY KEY CLUSTERED ([Col1], [Col2]/*, [Col3] */) WITH FILLFACTOR = 95 ON [PRIMARY] )

create table Table_A_Feb (Col1 int not null,Col2 datetime not null CHECK (col2 = 'RP') --(Col2 >= cast('20060201' as datetime) and Col2 < cast('20060301' as datetime))--,--Col3 char(5) not null, CONSTRAINT [PKFeb] PRIMARY KEY CLUSTERED ([Col1], [Col2]/*, [Col3]*/) WITH FILLFACTOR = 95 ON [PRIMARY] )

CREATE VIEW A AS SELECT * FROM Table_A_Jan

UNION ALL

SELECT * FROM Table_A_Feb

Then the insert

INSERT INTO A (Col1, Col2/*, Col3*/) VALUES (45, 'RL'--'2006-01-21 23:55:34.000'--, '00073' )

And the resulting error message

because the primary key of table '[AAAA].[dbo].[Table_A_Jan]' is not included in the union result.

As long as I keep Col2 as date time everything works. Why does it fail when I want the CHECK contraint to be equal to a particular string?

(Sorry about the font issue don't get what is going on here)

Andrew.

This forum where you will seek help for Analysis Services related questions. I know your quest started from exploring solutions for Analysis Services application, but looks like you missing some basic knowlege on relational databases (SQL Server and likes). I suggest you get yourself a good book or tutorial on how to work with SQL.

HTH

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

Friday, February 17, 2012

Creating expressions with the query builder

Hello,

I have a question about using the query builder, or just straight sql, to create expressions. My first example caused the query builder to generate a query configuration error:

Expression: EIM_REQUISITION_DETAILS.EST_UNIT_COST * EIM_REQUISITION_DETAILS.REQRD_QTY AS COST


Syntax error: Expecting "," or "FROM" after column alias or "*"


Initially I thought I was dead in the water but then I decided to just run it anyway and it worked! I got my cost. OK so fine the query tool doesn't recognize some sql expressions. Because I am trying to make a large flat file I thought I'd concatenate 2 fields to generate a recognizable requisition, which everyone knows is the year followed by a hyphen then the req number:

My old Access query had this: Req: Right([REQ_YR],2) & "-" & [REQ_NO]

and I tried to change it to this: substring (EIM_REQUISITIONS.REQ_YR from 2 for 2) || '-' || EIM_REQUISITIONS.REQ_NO AS REQ

So apparently my older sql book doesn't have the syntax right. Since I plan to do more of this could someone point me to a reliable book or site that could help me with sql syntax?

Thanks,
Dana






Move the thread from Visual Basic General forum. The question is on SQL Server Reporting Service issue. There are more exports in this forum to solve the problem in Query Builder, I believe you can get the satisfying answers in this forum.

Thanks again for your question.

|||The built-in Books On Line (BOL) help file has all the info you need on this topic

Creating expressions with the query builder

Hello,

I have a question about using the query builder, or just straight sql, to create expressions. My first example caused the query builder to generate a query configuration error:

Expression: EIM_REQUISITION_DETAILS.EST_UNIT_COST * EIM_REQUISITION_DETAILS.REQRD_QTY AS COST


Syntax error: Expecting "," or "FROM" after column alias or "*"


Initially I thought I was dead in the water but then I decided to just run it anyway and it worked! I got my cost. OK so fine the query tool doesn't recognize some sql expressions. Because I am trying to make a large flat file I thought I'd concatenate 2 fields to generate a recognizable requisition, which everyone knows is the year followed by a hyphen then the req number:

My old Access query had this: Req: Right([REQ_YR],2) & "-" & [REQ_NO]

and I tried to change it to this: substring (EIM_REQUISITIONS.REQ_YR from 2 for 2) || '-' || EIM_REQUISITIONS.REQ_NO AS REQ

So apparently my older sql book doesn't have the syntax right. Since I plan to do more of this could someone point me to a reliable book or site that could help me with sql syntax?

Thanks,
Dana






Move the thread from Visual Basic General forum. The question is on SQL Server Reporting Service issue. There are more exports in this forum to solve the problem in Query Builder, I believe you can get the satisfying answers in this forum.

Thanks again for your question.

|||The built-in Books On Line (BOL) help file has all the info you need on this topic

Creating documentation

I was wandering if anybody can tell me if SQL Server has
the ability to create documentation based on the tables
created. For example, if I create database, from that
database I want to create document.
Not really out of the box. Have a look at
http://www.ag-software.com/sqlscribe/
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"Barbara" <anonymous@.discussions.microsoft.com> wrote in message
news:361901c51f50$68f8fcc0$a601280a@.phx.gbl...
>I was wandering if anybody can tell me if SQL Server has
> the ability to create documentation based on the tables
> created. For example, if I create database, from that
> database I want to create document.

Tuesday, February 14, 2012

Creating databases under Master

When creating databases is it a good idea to use the master.dbo.sysdatabases database and then create databases under this.

An example I saw for a forum app did this:

IF EXISTS(SELECT name FROMmaster.dbo.sysdatabasesWHERE name= N'EggHeadCafeForum')

DROP DATABASE[EggHeadCafeForum]

GO

CREATE DATABASE[EggHeadCafeForum]ON(NAME= N'EggHeadCafeForum_Data', FILENAME = N'C:\EggHeadCafeForum_Data.MDF' ,SIZE= 5, FILEGROWTH = 10%)LOG ON(NAME= N'EggHeadCafeForum_Log', FILENAME = N'C:\EggHeadCafeForum_Log.LDF' ,SIZE= 1, FILEGROWTH = 10%)

COLLATESQL_Latin1_General_CP1_CI_AS

GO

It would offer one advantage in terms of when having the site hosted all my databases could be moved under the masterdatabase,However I am thinking there may be disadvantages, one being I use theasp.net roles/admin database that isn't created under master

Any feedback would be great.

Cheers

Adam

You cannot create a database "under" master database. All DB's are at the same level. "sysdatabases" is a table located in master db that has a listing of all the databases on the server. So the code "IF EXISTS.." is only checking if the DB already exists by querying against the list and if it does, its dropping it and recreating it.

|||You can connect to master and create the database from there. The database you created however is not UNDER master. There isn't a hierarchy in databases.|||Thanks guys, see what you mean nowYes|||Thanks guys, see what you mean nowYes