I have two servers and I need to transfer all the details of a particular user from one server to another server
I selected row from one server and no开发者_JAVA百科w I have to insert into another server of a table
I selected the row and I return it in datatable
select *
from [mp_Sites]
where SiteID = " + siteid + "
Now I called the stored procedure which is present in the server2 to insert into the table which is selected from server1
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@1", SqlDbType.Int).Value = moduleId;
cmd.Parameters.Add("@2", SqlDbType.VarChar).Value = dtEventsXmls.Rows[i]["SettingName"].ToString();
cmd.Parameters.Add("@3", SqlDbType.VarChar).Value = dtEventsXmls.Rows[i]["SettingValue"].ToString();
cmd.Parameters.Add("@4", SqlDbType.VarChar).Value = dtEventsXmls.Rows[i]["ControlType"].ToString();
cmd.Parameters.Add("@5", SqlDbType.NText).Value = dtEventsXmls.Rows[i] ["RegexValidationExpression"].ToString();
I think its complicated - if you have any idea please let me know ..
- You can learn how to set up a "Linked Server" and easily do what you want to do. -or-
- You can use SSIS to do this. -or-
- You can use the BCP command line utility in SQL Server to export the data to a file and use the BULK INSERT t-sql command to insert it on the other server. This would be the fastest and simplest way to go. -or-
- You can use the Openquery command to access the other server in SQL code to get the data.
精彩评论