Monday, 19 March 2012

CONNECT TO

Hello,
I have 3 registrations under a Server Group. They are all connected using
Windows NT. I was trying to use the following in SQL Query Analyzer to
execute a stored procedure that was in another registration I got the
following code from books on line:
EXEC SQL CONNECT TO "Reg2.Funds";
However, I get the error: Incorrect syntax near the keyword 'TO'.
Any help with this would be appreciated.
Thanks in advance,
sck10
Thats for embedded SQL in C.
If you want to in SQL Server you can go by the four part name:
example:
Select * from [servername].[databasename].[owner].[objectname]
where servername can be left out if you are not using a linked server, if
you want to use a linked server (connect to any other SQL Server than the
actual one, or even another instance) you have to conigure that but adding a
new linked server.
HTH, Jens Suessmeyer.
"sck10" <sck10@.online.nospam> wrote in message
news:O9rgf2YiFHA.1480@.TK2MSFTNGP10.phx.gbl...
> Hello,
> I have 3 registrations under a Server Group. They are all connected using
> Windows NT. I was trying to use the following in SQL Query Analyzer to
> execute a stored procedure that was in another registration I got the
> following code from books on line:
> EXEC SQL CONNECT TO "Reg2.Funds";
> However, I get the error: Incorrect syntax near the keyword 'TO'.
> Any help with this would be appreciated.
> --
> Thanks in advance,
> sck10
>
|||Hi sck10,
Thanks for your posting!
Based on my knowledge, CONNECT TO is embedded SQL for C. You cannot use it
in Query Analyzer directly. To call another SQL Server's stored procedure,
add another SQL Server as linked server and then call using the four parts
naming: [Server].[Database].[Owner].[Object]
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.

No comments:

Post a Comment