Showing posts with label regarding. Show all posts
Showing posts with label regarding. Show all posts

Friday, March 23, 2012

extending RS for Connection String only

I know there have been many questions regarding extending RS to report off of
different data sources (xml, ado etc) - we are successfully running our
reports off of SQL Server stored procedures and are using the web services
(not url) to render directly to PDF from a custom asp .net UI. We would like
to leave this as is, tying the RS Datasource to a SQL Server stored procedure
and leaving it at that. Is it possible to use only the connection interfaces
(IDbConnection) in conjunction with the web services to programmatically
switch between datasources? Or do you have to implement the whole nine yards
(IDbCommand, Parameter, Transaction, Reader etc.) and run reports off of a
custom dataset in order to switch the connection string?
Thanks,ok, I realize maybe that was a stupid question. Here is another one. If we
need to create a custom data extension in order to manipulate the connection
string, is it possible to create a 'custom' data extension that executes SQL
Stored Procedures using the .net SqlCommand for its 'custom data', seeing as
how we have the reports up and running using the stored procedures?
I am trying desperately to figure out the best approach to take. We need to
be able to switch to one of 60 + databases depending on the user requesting
the report. The custom code is in place, the reports done and working - what
would anyone suggest would be the best way to accomplish the last piece of
this puzzle?
"Myles" wrote:
> I know there have been many questions regarding extending RS to report off of
> different data sources (xml, ado etc) - we are successfully running our
> reports off of SQL Server stored procedures and are using the web services
> (not url) to render directly to PDF from a custom asp .net UI. We would like
> to leave this as is, tying the RS Datasource to a SQL Server stored procedure
> and leaving it at that. Is it possible to use only the connection interfaces
> (IDbConnection) in conjunction with the web services to programmatically
> switch between datasources? Or do you have to implement the whole nine yards
> (IDbCommand, Parameter, Transaction, Reader etc.) and run reports off of a
> custom dataset in order to switch the connection string?
> Thanks,

Wednesday, March 21, 2012

Extended stored procedure xp_cmdshell

Hello,

I have a question regarding the extended SPC 'xp_cmdshell'.

Basically I want to determine the username and userdomain in a stored procedure and what I know is that you can get this information in a "DOS-Box" with 'Set username' or 'Set userdomain'.

But if I use the above mentioned extended stored procedure in the following way:

exec master..xp_cmdshell 'set username'
I don´t get any resultset.

Does anyone know why I get different results depending on the fact if I call the 'set'-command in a "DOS-Box" or with the appropriate stored procedure?

Thank you for any help>>Basically I want to determine the username and userdomain in a stored procedure and what I know is that you can get this information in a "DOS-Box" with 'Set username' or 'Set userdomain'.

You are aware that xp_xmdshell is running in the context of Sql Server. So you will only ever see information pertaining tho the server - not any client.

What user and domain are you trying to retrieve? The client connecting to SQL Server or the Server itself?|||Hello,

yes, you are absolutely right! I am aware of this but I have just tried this on my local machine. I have installed SQL-server local and I was just wondering because of this differences on the same machine. I know that I can´t use this in a production environment because of the fact that this SPC is running in the context of the server and does not affect any client.

What I basically want is to retrieve the domainname and -user of the client connection with a stored procedure.

Do you know a practicable method to do this?

Thanks,|||SQL Server provides several functions for this purpose each with differing behavior. Have a look in SQL Server Books Online at the following keywords for starters:

USER_NAME()
SESSION_USER
USER|||Hello,

thank you for the advice to the functions of sql server. I have looked around now for a while and have found a function which returns indeed the domainname and domainusername of the connected client.
Just beside -- the functions you mentioned just give back the actually sql-server user in the selected database which is in my environment always 'dbo'.

You can get the domaininfo with the following piece of code:DECLARE @.System_User char(30)
SET @.System_User=SYSTEM_USER
PRINT @.System_User
Regards,

Monday, March 19, 2012

Extended Properties

I am having some wierd behavior that I can't seem to correct regarding exteneded properties. Via a T-SQL statement, I have added several exteneded properties to a table, for example:

exec sp_addextendedproperty N'AP121ID', @.value = 'AP121 Primary Key',
@.level0type = N'Schema', @.level0name = dbo,
@.level1type = N'Table', @.level1name=ap121,
@.level2type = N'Column', @.level2name=AP121ID;
GO

This statement runs successfully. I can even query the sys.extended_properties table and see the entries.

However, if i look at the properties of teh table to which I added the exteneded properties, they are not listed. Nor does it allow me to add one via that properties page.

Any ideas?

Thanks...

Scott

Looks like you are adding extended properties to the column of the table and not the table itself.

Can you check for extended properties on the table column via the properties page ?

|||Ah, yep, that was it. Thanks!

Extended Properties

I am having some wierd behavior that I can't seem to correct regarding exteneded properties. Via a T-SQL statement, I have added several exteneded properties to a table, for example:

exec sp_addextendedproperty N'AP121ID', @.value = 'AP121 Primary Key',
@.level0type = N'Schema', @.level0name = dbo,
@.level1type = N'Table', @.level1name=ap121,
@.level2type = N'Column', @.level2name=AP121ID;
GO

This statement runs successfully. I can even query the sys.extended_properties table and see the entries.

However, if i look at the properties of teh table to which I added the exteneded properties, they are not listed. Nor does it allow me to add one via that properties page.

Any ideas?

Thanks...

Scott

Looks like you are adding extended properties to the column of the table and not the table itself.

Can you check for extended properties on the table column via the properties page ?

|||Ah, yep, that was it. Thanks!