samedi 25 avril 2015

Change SQL Server primary key using C#

I need to change a column type in a SQL Server table.

I need do it using a script or C#.

The original datatype is integer and the new type is varchar(50).

I can do it using this SQL script:

ALTER TABLE confezionamento ALTER COLUMN partnumber varchar(50) 

but the problem is that this column is in a set of primary keys.

When I try do execute, an error occurred because PK_CONFEZIONAMENTO is using the column.

How I can do it without access to SQL Server Management Studio?

Aucun commentaire:

Enregistrer un commentaire