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 |
|
sunny_pa
Starting Member
2 Posts |
Posted - 2010-12-02 : 04:37:15
|
| sir, i have two databases named db1 and db2. T1 is table in db1 and have certain properties like foriegnkey etc. i wanna creat new table T2 in db2 with same properties that of T1. what query should i use.regardssunny gupta |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-12-02 : 04:46:15
|
| Easiest to sript the table definition (using management studio), change the table name and run the script.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
kashyap_sql
Posting Yak Master
174 Posts |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
|
|
sunny_pa
Starting Member
2 Posts |
Posted - 2010-12-02 : 06:15:11
|
| but sir, what if both tables dont have same structure and we wanna copy T1 as it is to T2 |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-12-02 : 06:18:42
|
| If you copy T1 as it is to T2 then they will have the same structure (by definition).If you want the structures to be different then change the creation script before applying it.Just to clarify from your OP - T2 doesn't exist and you want to create it with the same properties as T1.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|