Solved

TSQL syntax for adding a new column and making it a primay key as well.

Posted on 2011-03-10
2
297 Views
Last Modified: 2012-05-11
Hi, Does this look about right?
ALTER TABLE dbo.q_degree_type(
      ADD [DegreeTypeId] [int] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [PK_degree_type] PRIMARY KEY CLUSTERED
(
      [DegreeTypeId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
0
Comment
Question by:lapucca
2 Comments
 
LVL 15

Accepted Solution

by:
derekkromm earned 500 total points
ID: 35102834
close:

alter table dbo.q_degree_type add DegreeTypeId int identity(1,1) not null
constraint PK_degree_type primary key clustered (DegreeTypeId asc)
WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

0
 

Author Closing Comment

by:lapucca
ID: 35102954
Yeah, try to modify a generate script and got messed up with the parenthesis and the commas.  Thank you.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now