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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 create table script

Author  Topic 

al_gsy
Starting Member

6 Posts

Posted - 2006-07-16 : 10:42:30
Hi, i want to develop a reusable sp for creating tables. My question is how best can I develop the script so that I can run the sp to create for example one table with 3 fields and then re-run the script to create a table with 5 fields and so on?

nr
SQLTeam MVY

12543 Posts

Posted - 2006-07-16 : 10:46:40
Why would you want to do that?

You will have to pass in the name, type, length, nullability, defaults, constraints for each column.
Why not just write a create table statement.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

al_gsy
Starting Member

6 Posts

Posted - 2006-07-16 : 12:09:46
it was a theoretical problem. Create statments are great, but if I could use a general purpose sp then maybe I could create the tables a little quicker.
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-07-16 : 12:14:29
Doubt it - you would have to type almost as much. There's not a lot of wasted characters in a create table statement.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-07-16 : 23:10:17
Are you planning to create the table dynamically ? That does not sounds like a good idea.


KH

Go to Top of Page
   

- Advertisement -