create a database table

  • Thread starter Thread starter Claudia Fong
  • Start date Start date
C

Claudia Fong

Hello,

I know that we can use C# to connect to a database and using SQL to read
data from the tables, update tables, delete record, is there any way to
create a table or copy the structure of one table to another?

For example, I have a table dep2004, but now I want to create exactly
the same table, but it will call dep2005. I need to clear some data of
the new table, but I think I can manage it, but what I don't know how to
do it is create the table...


Can someone help me?

Cheers!

Claudi
 
Assuming that you have the authority to create tables in the database:

SELECT
*
INTO
dep2005
FROM
dep2004
WHERE
1 = 0

is a way to create an empty copy of a table.
 
First of all thanks Brendan.

It works, but I still have one little problem:

In my old table DEP2004, I have one field that the property allow zero
length is YES, but after creating the new table DEP2005, this property
change to NO. It means it won't allow zero lenght.. How can I change
this property in C#?

My database is stored in Access.

Do you know how should I do?
Cheers!

Claudi
 
Back
Top