Showing posts with label available. Show all posts
Showing posts with label available. Show all posts

Monday, March 12, 2012

How to call SP of one SQL server from other SQL server

Hi,

In my application environment, we have data will be in available in different SQL servers.

I hava requirement to call the SP of on SQL server from the SP in the other SQL server.

Can any one help me out for a solution which will be faster?

Please note that I cant go for the linked servers as the other SQL severs credentials will be stored in a Database table and it has to be used in run time of the SPs.

Awaiting quick response from you all..

Thanks in advance.

-Thams

YOu can use the openrowset for that:

DECLARE @.USERNAME VARCHAR(50)

DECLARE @.Password VARCHAR(50)

DECLARE @.SQLString VARCHAR(500)

SET @.USERNAME = 'SomeUser'

SET @.Password = 'SomePassword'

SET @.SQLString = '

SELECT a.*

FROM OPENROWSET(''SQLNCLI'', ''Data Source=.;UserName=' + @.USERNAME + ';Pwd=' + @.Password + ';'',

''EXEC Northwind.dbo.[Ten Most Expensive Products]'') AS a;

'

SELECT @.SQLString

EXEC(@.SQLString)

Jens K. Suessmeyer

http://www.sqlserver2005.de

Friday, February 24, 2012

How to calculate actual size of column?

Hi,
I am wondering if any equivalent function available which
gives the actual length of column in bytes as VSIZE in
Oracle?
If not how to calcuate actual column size?
Thanks in advance.
RajIs the DATALENGTH function what you're looking for? For example:
SELECT DATALENGTH(au_lname)
FROM pubs..authors
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"Raj" <vmresumes@.yahoo.com> wrote in message
news:8fdb01c345a2$356250c0$a401280a@.phx.gbl...
> Hi,
> I am wondering if any equivalent function available which
> gives the actual length of column in bytes as VSIZE in
> Oracle?
> If not how to calcuate actual column size?
> Thanks in advance.
> Raj