Sunday, March 11, 2012

Connecting to another SQL SErver

Hello, All!
I am trying to connect to another instance using Transact SQL, but I didn't
get it yet.
Could we help me with it?
I tryed to use, CONNECT TO, but I always receive the same error message.
CONNECT TO server.db USER usr.password
"Incorrect syntax near the keyword 'to'."
Thanks
Juliano Horta
--
Message posted via http://www.sqlmonster.comYou cannot switch instance for your connection. The instance the connection logged on to is the one
it has to live with. The client app can do this, but not at the TSQL level. Perhaps you should look
into the Linked Servers concept?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Juliano H via SQLMonster.com" <u13014@.uwe> wrote in message news:5a9702b47ea38@.uwe...
> Hello, All!
> I am trying to connect to another instance using Transact SQL, but I didn't
> get it yet.
> Could we help me with it?
> I tryed to use, CONNECT TO, but I always receive the same error message.
> CONNECT TO server.db USER usr.password
> "Incorrect syntax near the keyword 'to'."
> Thanks
> Juliano Horta
> --
> Message posted via http://www.sqlmonster.com|||Thanks very much!
I will take a look into the Linked Server.
Bye
Tibor Karaszi wrote:
>You cannot switch instance for your connection. The instance the connection logged on to is the one
>it has to live with. The client app can do this, but not at the TSQL level. Perhaps you should look
>into the Linked Servers concept?
>> Hello, All!
>[quoted text clipped - 9 lines]
>> Juliano Horta
--
Message posted via http://www.sqlmonster.com|||Hi Juliano,
Create link server that try using query.
Jitesh k
"Juliano H via SQLMonster.com" wrote:
> Hello, All!
> I am trying to connect to another instance using Transact SQL, but I didn't
> get it yet.
> Could we help me with it?
> I tryed to use, CONNECT TO, but I always receive the same error message.
> CONNECT TO server.db USER usr.password
> "Incorrect syntax near the keyword 'to'."
> Thanks
> Juliano Horta
> --
> Message posted via http://www.sqlmonster.com
>|||If you are trying to do a simple select (assuming you have permissions) you
need to either use OPENROWSET or set up a linked server and use:
Select col1, col2
From [Server\instance2].[Mydb].[dbo].MyTable
Kevin Hill
3NF Consulting
www.3nf-inc.com/NewsGroups.htm
www.expertsrt.com - not your average tech Q&A site
"Juliano H via SQLMonster.com" <u13014@.uwe> wrote in message
news:5a9702b47ea38@.uwe...
> Hello, All!
> I am trying to connect to another instance using Transact SQL, but I
> didn't
> get it yet.
> Could we help me with it?
> I tryed to use, CONNECT TO, but I always receive the same error message.
> CONNECT TO server.db USER usr.password
> "Incorrect syntax near the keyword 'to'."
> Thanks
> Juliano Horta
> --
> Message posted via http://www.sqlmonster.com|||Thanks very much!
It executed properly.
Very nice
Bye
Kevin3NF wrote:
>If you are trying to do a simple select (assuming you have permissions) you
>need to either use OPENROWSET or set up a linked server and use:
>Select col1, col2
>From [Server\instance2].[Mydb].[dbo].MyTable
>> Hello, All!
>[quoted text clipped - 10 lines]
>> Juliano Horta
--
Message posted via http://www.sqlmonster.com

No comments:

Post a Comment