Making a column non-null and unique in SQL Server 2005#
Someone asked me how to do this the other day, and I couldn't find a simple way to do it in the SQL Server Management Studio, but the script is pretty simple:

ALTER TABLE tablename
ALTER COLUMUN
   columnname varchar(50) NOT NULL
GO ALTER TABLE tablename ADD CONSTRAINT constraintname UNIQUE( columnname ) GO
Categories:  |  | 
Thursday, June 28, 2007 7:10:19 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Name
E-mail
(will show your gravatar icon)
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

All content © 2008, Christopher May, Inc
Open Job Positions
On this page
Google Ads
This site
Calendar
<June 2007>
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 1.9.6264.0

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts


Pick a theme: