sql - Convert string id of column to int autoincrement -
i have table cars
id nvarchar(25) pk name nvarchar(max)
and there records.
id name codexyz namezxc codeqaz nameasd codeedc nameqwe
i want convert id column int autoincrement:
id name 1 namezxc 2 nameasd 3 nameqwe
but have no idea how make :/ me ?
in sql server management studio, can right click on table, , modify it.
once in there, select column want auto increment. should able change int.
then @ column properties; 1 of them identity, unique , auto-incrementing field. turning property on, , saving changes, want.
if have duplicates in field though, or values can't cast int, fail. need run update on table rid of problems or duplicates first.
edit:
you made comment "all records strings". if string values don't cast int, can't have waht you're asking for. field looking "aaabc" can't auto-incremented.
Comments
Post a Comment