Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 364
  • Last Modified:

alter is identity

How can I alter is identity from NO to Yes from tsql?  We have sql 2008 server R2.
table.jpg
0
VBdotnet2005
Asked:
VBdotnet2005
  • 2
1 Solution
 
guswebbCommented:
When you click on 'No' (to the right of Is Identity)  do you not get a drop-down menu allowing you to select Yes?
0
 
guswebbCommented:
If this is a pre-existing column you can't alter it. You need to create a new column and set Is Identity at that point, then drop your current column.
0
 
VBdotnet2005Author Commented:
Under Identity Specification, I want to set Is Identity to Yes in TSQL. I know how to do it in design. This is a brand new table.

Link
0
 
YaraKnightCommented:
In a new query window where Names is your table name, and 'Column' is your desired column name:

Alter Table Names
Add Id_new Int Identity(1, 1)
Go

Alter Table Names Drop Column ID
Go

Exec sp_rename 'Names.Id_new', 'ID', 'Column'
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now