| Author |
Topic |
|
kiwy
Starting Member
6 Posts |
Posted - 2005-10-01 : 20:09:44
|
I'm looking for a way of getting the create table sql script.In mysql i use to do it with "SHOW CREATE TABLE table_name", but i cannot find any equivalent in mssql.Is there a SP that dose this?i'm new to mssql, so dont be very hursh with me thanks |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-10-02 : 08:48:04
|
| HiWhat i understood is that you want the script for creating table in SQL Server. There are 2 ways of doing that,1 Using Query Analyser in the Query Analyser in the toolbar there is option of object browser or you can press f8 there u can see all the database which are attached to the particular server... then go to the database where u want to script the tables.. Right click on the table then you will get the option of Script object.. there are 3-4 options over there you can check them.. how you want the script to be viewed.. The 2nd option is using the enterprise manager Go to the databse and then right click on the table .. click on All Tasks and then click on the Generate Script and you can view the scripts.. for creating ..the tables.. I hope this helps you.. All the best ..Complicated things can be done by simple thinking |
 |
|
|
kiwy
Starting Member
6 Posts |
Posted - 2005-10-02 : 09:07:00
|
| The problem is that i want to be able to this from my app. and not from a visual tool. |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-10-02 : 09:27:53
|
| That's why I pointed you in the direction I did. Did you look at it?MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
kiwy
Starting Member
6 Posts |
Posted - 2005-10-02 : 11:07:41
|
quote: Originally posted by derrickleggett That's why I pointed you in the direction I did. Did you look at it?MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA.
yes. and i need a litle help with redirecting the output of s_ScriptObjects SP not to a file, but as returning values.because i'll execute the sp over the network via ado.i think this is the part where i should make the changes, but i need some help ---- exec @rc = sp_OAMethod @objServer, @sql , @buffer OUTPUT, @ScriptType , @tmpFileName select @sql = 'type ' + @tmpFileName + ' >> ' + @FileName exec master..xp_cmdshell @sql---- |
 |
|
|
viljun
Starting Member
1 Post |
Posted - 2010-01-08 : 15:29:43
|
quote: Originally posted by kiwy I'm looking for a way of getting the create table sql script.In mysql i use to do it with "SHOW CREATE TABLE table_name", but i cannot find any equivalent in mssql.Is there a SP that dose this?i'm new to mssql, so dont be very hursh with me thanks
I just wrote this for you (in asp). There's also show create database -function:[url]http://www.varuste.net/show_create_table.html[/url]Ville |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-01-08 : 15:44:49
|
| Wow. That's what I call thread necromancy |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-01-11 : 02:15:25
|
quote: Originally posted by russell Wow. That's what I call thread necromancy
Now-a-days most of the first time posters start answering to the very old question first MadhivananFailing to plan is Planning to fail |
 |
|
|
|