H all,
Fist of all, thanks for r开发者_如何学运维eading this. My Question is, how can I select a bunch of data from ANOTHER database and insert to my own database with same coloum name and field? I just can think of is using select from DB1 and then insert into DB2. I plan to written this process inside a stored procedures. Is there a better way to do so?
Development enviroment :Sql server 2008 and VS2010(using .net C# to excecute Stored prod) Thank you, Appreciate its lot. And Please don't hesitate to voice out my error or mistake.I wish to learn from mistake
LiangCk
You can do the following if its the same database server
INSERT INTO [DB].[UserName].[TableName]
Select * from [DB2].[UserName].[TableName]
- [DB] is the name of database 1
- [DB2] is the name of database 2
- [UserName] is your sql server username (dbo,....)
- [TableName] is, off course, your table
If you have different sql servers you can connect both servers using linked server.
http://msdn.microsoft.com/en-us/library/ff772782.aspx
精彩评论