May 7, 2012 at 3:31 am
Can I connect another SQL Server DB without add Linked Server?
May 7, 2012 at 3:38 am
Try OPENROWSET/OPENDATASOURCE
May 7, 2012 at 7:59 am
a couple of basic examples:
--connect via trusted connection using your domain credentials
SELECT *
FROM OPENROWSET('SQLOLEDB','Server=yourservernamehere;Trusted_Connection=Yes;Database=Master',
'Set FmtOnly OFF; SELECT * from sys.tables')
--connect via SQL username/password
SELECT *
FROM OPENROWSET('SQLOLEDB','Server=DEV223;Trusted_Connection=No;UID=Noobie;Pwd=NotARealPassword;Database=Master',
'Set FmtOnly OFF;SELECT * from sys.tables')
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply