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 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-09-11 : 12:10:07
|
| 1-I want to save records from a table located in my database1 on Server1 to a non existing table in another database2 in another server2. (The destination table doesn t exist, I want it to be created with T-SQL). How can I do that using T-SQL2- Also, is there an other better practice to back up my table before I do some dammage inintentially and destroy the table or the records forever or does SQL server do that automatically for us.Thanks a lot for your advice. |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-09-11 : 12:16:26
|
| 1. SELECT .... INTO NewTableFROM ....NewTable can be in a different database, just use a three part name databasename.ownername.tablename2. No, SQL Server does not keep copies for you. If you're backing up the database and the transaction log you have a bunch of restore options, but not as simple as just getting back a few rows. You need to either copy to a new table with SELECT ... INTO, or INSERT ... SELECT to use an existing table.SQL Server 2005 has a very cool new feature called database snapshots that make it much easier too. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-09-11 : 12:26:00
|
| To export records from a table on db1 on server1 to db2 on server2, you have 3 options:1) Add server2 as linkedserver to server1 and then using four-part naming, use Select...into syntax2) Use OPENDATASOURCE() function to temporarily connect to server2 and export records using select...into statement3) Use more sophisticated tool like DTSHarsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2006-09-11 : 12:32:25
|
| Thank you |
 |
|
|
|
|
|