Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
temperature
Starting Member
5 Posts |
Posted - 2008-06-21 : 10:56:44
|
hello everybody,how can I move (or copy) a table from one database to another database in ms sql server? does a syntax code exist for that operation. thanks a lottemp |
|
temperature
Starting Member
5 Posts |
Posted - 2008-06-21 : 10:59:03
|
both databases are on the same server... |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-06-21 : 11:22:35
|
if table2 doesn't exist in db2:select <columns here> into db2..table2from db1..table1if table2 does exist in db2:insert into db2..table2 (<columns here> )select <columns here> from db1..table1_______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
|
|
temperature
Starting Member
5 Posts |
Posted - 2008-06-21 : 11:38:26
|
thanks. that is exactly what i was looking for.bye |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-06-21 : 12:39:25
|
You have to copy indexes and constraints as it won't get copied. |
|
|
|
|
|