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 |
|
zubair
Yak Posting Veteran
67 Posts |
Posted - 2009-02-05 : 11:13:35
|
| I need to perform the following task:1.get a sql script of a table including primary key, foreign keys and contraints2. running the sql script above in another databaseI need to do this on a regular basis. Is there a way to automate this task instead of manually having to get the script via enterprise manager and then copying and pasting into query anayluser and running against new database? I think this can be done via OSQL? Does anyone have an example i could base mine on? Thx |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-05 : 11:20:21
|
| You can use Generate Script Task in SSMS. |
 |
|
|
zubair
Yak Posting Veteran
67 Posts |
Posted - 2009-02-05 : 11:49:14
|
| Can you tell me how to do this? I am a bit new qith sql server. Do you have an example? |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-05 : 11:54:15
|
| Right Click Database-Task |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-05 : 12:05:16
|
| http://msdn.microsoft.com/en-us/library/ms178078.aspx |
 |
|
|
zubair
Yak Posting Veteran
67 Posts |
Posted - 2009-02-05 : 12:12:00
|
| sodeep, i don't think you're gettin what i'm trying to do. I DON't want to use enterprise manager... thats the whole point of automation.... not very helpful at all. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-05 : 12:20:54
|
quote: Originally posted by zubair sodeep, i don't think you're gettin what i'm trying to do. I DON't want to use enterprise manager... thats the whole point of automation.... not very helpful at all.
Put the generated script in SQL job and automate(schedule)it whenever you need to. |
 |
|
|
|
|
|