c# 2005-.sql2005 Adding a table

in c# 2005 how can i dynamically add a column to an  SQL table.  please include info to set the column parameters
LVL 9
the_b1ackfoxCIOAsked:
Who is Participating?
 
sjturner2Commented:
You need to execute an alter table sql statement:

ALTER TABLE <table_name>
ADD <column_name1> <datatype1> <constraint1>

to add a primary key

ALTER TABLE xx ADD primary key(<column>)

Again, execute the sql commands using ADO.NET SqlCommand.ExecuteNonQuery.
0
 
the_b1ackfoxCIOAuthor Commented:
PS  please include whatever options to set the primary key
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.