sp_addlinkedserver
------------------sp_addlinkedserver-------------------
EXEC sp_addlinkedserver
@server='Ramesh', ---This is UserDefined Name
@srvproduct='',
@provider='SQLNCLI', --That means this is SQL Server
@datasrc='S1\instance1'--ServerName or InstanceName and the Want to give username password give these thi server sqlserver user name and password.
------
Some times we need to create linked servers to access .csv files in the system for that we need to create below script.
--This linked server will access the files of .csv which are in E drive and in Temp Folder.
EXEC SP_ADDLINKEDSERVER RAWFILE, 'Jet 4.0'
, 'Microsoft.Jet.OLEDB.4.0'
, 'E:\TEMP\'
, NULL
, 'Text'
GO
SELECT * FROM RAWFILE...SOSWTFcutdown#csv
EXEC sp_addlinkedserver
@server='Ramesh', ---This is UserDefined Name
@srvproduct='',
@provider='SQLNCLI', --That means this is SQL Server
@datasrc='S1\instance1'--ServerName or InstanceName and the Want to give username password give these thi server sqlserver user name and password.
------
Some times we need to create linked servers to access .csv files in the system for that we need to create below script.
--This linked server will access the files of .csv which are in E drive and in Temp Folder.
EXEC SP_ADDLINKEDSERVER RAWFILE, 'Jet 4.0'
, 'Microsoft.Jet.OLEDB.4.0'
, 'E:\TEMP\'
, NULL
, 'Text'
GO
SELECT * FROM RAWFILE...SOSWTFcutdown#csv
Comments