January 27, 2011 at 9:27 am
Hello,
I'm writing a stored proc. in SQL Server 2005. I need to get data from another database in SQL Server 2005 on the same server.
Do I have to go down the linked server route or what is the syntax to do this?
SELECT *
FROM [dbo].[dbname].[dbtable]
?
thanks,
Paul
January 27, 2011 at 9:35 am
Linked servers are for databases on other servers.
FROM <database>.<schema>.<tablename>
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 28, 2011 at 12:24 am
require 4 parts for linked server, so it should be <server>.<database>.<schema>.<table>
sp_addlinkedserver 'serverA'
exec serverA...sp_who2 <= to test that your linked server work.
-----------------------------
www.cbtr.net
.: SQL Backup Admin Tool[/url] :.
January 30, 2011 at 10:42 pm
Don't need link server. Simply give..
select * from databasename..tablename
January 31, 2011 at 1:52 pm
thanks.....
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply