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-01-23 : 05:43:10
|
| Hi,I have the following scenario....I want to recreate a table from one db to another. I need to do this via a web front end. I am using coldfusion as my web application server. basically i am trying to write a custom function that will query the database and get the sql script for a table (this should include the indexes, triggers, primary key, foreign key, defaults and constraints)I want to then run this retreived sql script against the other database to recreate it. Does anyone know how I can achieve this?Any help or ideas greatly appreciated!ThanksZubair |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-23 : 06:24:32
|
| try like thisgoto database and right click -->tasks-->generatescripts-->u willget generate sql server scripts-->next--> select database-->in general include ifnot exists set true, script drop set true,use database false--> tablename --> next u will get the script the run that script in the new database but u will lost the data which is there in new database |
 |
|
|
zubair
Yak Posting Veteran
67 Posts |
Posted - 2009-01-23 : 06:31:21
|
| Thanks for that. Yes I know about that. But I want to do that via a web application. i.e I have a dynamic page such as a .asp or .php page which can query the db and get the script for a table. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-23 : 09:38:08
|
| make use of INFORMATION_SCHEMA.COLUMNS view for that |
 |
|
|
zubair
Yak Posting Veteran
67 Posts |
Posted - 2009-01-23 : 10:04:50
|
| thanks for that |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-23 : 10:34:57
|
| welcome |
 |
|
|
|
|
|