samedi 25 avril 2015

c# change primary key


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 values 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 into a set of primary key.

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

How I can do it? I can't access by SQL Server Management Studio.


Aucun commentaire:

Enregistrer un commentaire