Executing querys in distributed server
-
Hi frndz, In my machine, I have a MSSQL server named "Local" with one database "TEST1" and in server machine there is also one MSSQL server named "Sever" with one database named "TEST" with table "Tbl" My doubt is,is it possible to excute "select * from TEST.Tbl" query from query analyser of "local"'. Thanks in advance
All I ever wanted is what others have....
CrazySanker -
Hi frndz, In my machine, I have a MSSQL server named "Local" with one database "TEST1" and in server machine there is also one MSSQL server named "Sever" with one database named "TEST" with table "Tbl" My doubt is,is it possible to excute "select * from TEST.Tbl" query from query analyser of "local"'. Thanks in advance
All I ever wanted is what others have....
CrazySanker -
If you set up a linked server, you should be able to query databases on this server using the syntax
server.database.owner.table
Paul Marfleet
Thank u for your reply. I setup the linked server command like
EXEC sp_addlinkedserver 'server name', N'SQL Server' select * from [server name].[TEST].[dbo].[Tbl]
but it shows error likeServer: Msg 18452, Level 14, State 1, Line 7 Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
All I ever wanted is what others have....
CrazySanker -
Thank u for your reply. I setup the linked server command like
EXEC sp_addlinkedserver 'server name', N'SQL Server' select * from [server name].[TEST].[dbo].[Tbl]
but it shows error likeServer: Msg 18452, Level 14, State 1, Line 7 Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
All I ever wanted is what others have....
CrazySankerIf you are adding the linked server dynamically in code, you should call the
sp_addlinkedsrvlogin
SP to set up the login credentials required to access the linked server. Specify a SQL Server login if you can't access the linked server using a trusted connection. If the server you are connecting to isn't an instance of SQL Server, you can use theOPENQUERY
function to execute a pass-through query against the server.Paul Marfleet
-
If you are adding the linked server dynamically in code, you should call the
sp_addlinkedsrvlogin
SP to set up the login credentials required to access the linked server. Specify a SQL Server login if you can't access the linked server using a trusted connection. If the server you are connecting to isn't an instance of SQL Server, you can use theOPENQUERY
function to execute a pass-through query against the server.Paul Marfleet
Hi pmarfleet , Thanks for your reply.Now I got the solution. I add this as linked server through Enterprise manager->security->linked server when i tried this "exec sp_addlinkedserver" SP,it shows some problem. anyway now its working fine..:) Thank you once again for spending time for me!!!
All I ever wanted is what others have....
CrazySanker