When I am performing deletes from an Sql table, how would I do the following programmatically?
// SqlCommand ???
// do: ALTER TABLE tbl_CustomerInfo DROP CONSTRAINT PK_tbl_CustomerInfo
// ...perform deletions
// SqlCommand ???
// do: ALTER TABLE tbl_CustomerInfo ADD CONSTRAINT PK_tbl_CustomerInfo PRIMARY KEY CLUSTERED (RecordID)
I guess my question really is can I create an SqlCommand object with these ALTER statements?
Update
Here is the question showing my method for finding the dupe records and then deleting.
If the user account you are connecting to sql server with has the appropriate rights to issue DDL statements, then yes.
However, I’d consider that a security violation to even allow such a thing.
See msdn on how to structure the command.