Home > Archive > MS SQL Server > January 2006 > Connecting to another SQL SErver









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Connecting to another SQL SErver
Juliano H via SQLMonster.com

2006-01-19, 7:23 am

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.webservertalk.com
Tibor Karaszi

2006-01-19, 7:23 am

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?

--
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 webservertalk.com" <u13014@uwe> wrote in message news:5a9702b47ea38@u
we...
> 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.webservertalk.com


Juliano H via SQLMonster.com

2006-01-19, 7:23 am

Thanks very much!

I will take a look into the Linked Server.

Bye

Tibor Karaszi wrote:[color=darkred
]
>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?
>
>[quoted text clipped - 9 lines]

--
Message posted via http://www.webservertalk.com
Jiteshk

2006-01-19, 7:23 am

Hi Juliano,

Create link server that try using query.


--
Jitesh k



"Juliano H via webservertalk.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.webservertalk.com
>

Kevin3NF

2006-01-19, 7:23 am

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 & #91;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 webservertalk.com" <u13014@uwe> wrote in message
news:5a9702b47ea38@u
we...
> 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.webservertalk.com



Juliano H via SQLMonster.com

2006-01-19, 11:23 am

Thanks very much!

It executed properly.

Very nice

Bye

Kevin3NF wrote:[color=darkred
]
>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 & #91;Server\instance2
].[Mydb].[dbo].MyTable
>
>[quoted text clipped - 10 lines]

--
Message posted via http://www.webservertalk.com
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com