Friday 1 March 2013

Example of OPENDATASOURCE command using SQL Authentication

To run it with a SQL, just need to specify User ID and Password in the connection string


SELECT * FROM
opendatasource('SQLNCLI','Server=serverIP;Uid=sa;Pwd=serversqlpwd;
Database=DBName;').DBName.dbo.TableName
 
* SsrverIP - Liknked Server IP from you want to fatch Data 
* serversqlpwd - Linke Server Sql password 
* DBName- Linked Server Databse and TableName- Linked Server Table Name  
 
InserData to linked Server from your Local Server
 
Insert Into 
opendatasource('SQLNCLI','Server=serverIP;Uid=sa;Pwd=serversqlpwd;
Database=DBName;') .DBName.dbo.TableName (ColumnName) 
Select (Your Select Query) 
 
 
Any other info, mail on lokesh.snghl@gmail.com 

No comments:

Post a Comment