homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

Connect to another server with sql syntax

 4:14 pm on Jul 25, 2012 (gmt 0)

I need to connect to server b from server a using sql syntax to truncate a table. I cannot add it as a linked server. I've seen you can use openrowset but I need to truncate a table and I don't know how to do that. Any ideas?



 5:21 am on Jul 26, 2012 (gmt 0)

I have never tried it but SQL Server Integration Services [en.wikipedia.org] might due what your looking for.



 5:28 am on Jul 26, 2012 (gmt 0)

Scratch the previous post. I think I found a much much better way for you to do this ("OpenDataSource").



'Data Source=London\Payroll;Integrated Security=SSPI')


 2:02 pm on Jul 26, 2012 (gmt 0)

Yes, I was actually going to post back today, that's exactly what I used. I just had to create a stored procedure because I needed to truncate tables. So create the sp to truncate the tables on the actual database, and then from the other server EXEC OPENDATASOURCE('SQLNCLI','Data Source=SERVER\INSTANCE;Initial Catalog=dbName;User Id=user;Password=pass').[dbName].dbo.spName

Global Options:
 top home search open messages active posts  

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved