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
 SQL Server Development (2000)
 Dynamically Create Table

Author  Topic 

Nathan Brignall
Starting Member

2 Posts

Posted - 2008-08-07 : 14:28:29
Hey guys!

I have an html form that I want to create a new table when submitted. Is there a way to use input fields in the form ($username, $email, etc) and create a table with it:

"CREATE TABLE ('username', 'email')(

various values

)";

Thanks!

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2008-08-07 : 14:44:37
Terrible design -
Why don't you keep a permanent table and have the user actions add rows to the table?

Be One with the Optimizer
TG
Go to Top of Page

Nathan Brignall
Starting Member

2 Posts

Posted - 2008-08-07 : 16:28:03
Hey tg,

Ya, I know the design is a bit different but in this case, I think it's necessary. I want to allow users to post picture albums and thought that using a few of the fields from the form to give each user a table would be more organized. Is there a better way to do it?
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-08-07 : 17:02:44
It's not "a bit different" it's a terrible idea. How do you keep track of the dynamic tables you've created for a start? (and that's not going into the terrible performance implications of the requred (wholly dynamic) queries you'd have to use when referencing these tables.

Surely, a static table called users and a table called albums with a foreign key to users and a table called pictures with a foreign key to albums would be a much better solution.

-------------
Charlie
Go to Top of Page
   

- Advertisement -