Well, the first comment/question to you needs to be: WHY???
It's almost always a really bad idea to have more than one table in your database with the same design. If the only thing distinguishing your tables is the date that the data is entered into them, then you should use just one table and you should just add a single field (a DATETIME field, of course) to hold the date that the data pertains to.
If somebody has imposed this restriction upon you, you should question their database design skills. Even if there is a need for the data to be (say) exported on a daily basis, you would surely still be better off keeping it all in a single table and using queries to do the exporting as needed.
Having said all that...
If you still have to do this for some horrible reason, it's not hard. You can certainly simply execute a SQL statement to create the table:
Code:
CREATE TABLE name (
fieldname fieldtype,
...
)
Just put the entire CREATE into a string and use ExecuteNonQuery and presto, you have a table.
A more practical way might be to have one prototype table that you "clone". Unfortunately, SQL Server doesn't have a "create table xxx like yyy" as some DBs do. But you can simply do
Code:
SELECT *
INTO newtablename
FROM existingtablename
Provide a single dummy record in the existing table and voila! You have NEAR-clone in the new table. ("Near" because IDENTITY columns will become just INT, and you won't copy any foreign key info, and and and... But all those are easily fixed by follow-up ALTER TABLE statements.)
You *can* ask SQL Server if a table already exists, but if you are really bent on doing this ugly thing, I think I would create a separate table, just to keep track of which tables already exist.
But please please please consider NOT creating separate tables. It's just not a good solution, honest.