-6

I saw the command in my book project (book - teach yourself SQL in 10 mins, 2004):

ALTER TABLE Customers WITH NOCHECK 
ADD CONSTRAINT PK_Customers PRIMARY KEY CLUSTERED (cust_id);

Can you tell me what these commands mean (or give links with simple tutorials for these commands) :

  1. WITH NOCHECK
  2. CLUSTERED

Are there any alternatives to the above commands? Can I remove them ?

I am using the free edition of SQL Server 2008 R2 with latest updates.

Amro
  • 123,847
  • 25
  • 243
  • 454
  • I tried this link- http://odetocode.com/articles/79.aspx But, it is very confusing. It does not explain the concept for a beginner. – superfast Jun 09 '12 at 09:32

3 Answers3

4

You may download or use online book from MSDN.

  1. Microsoft SQL Server 2008 Books Online
  2. SQL Server Books Online
KV Prajapati
  • 93,659
  • 19
  • 148
  • 186
2

WITH NOCHECK will tell SQL Server not to validate the particular constraint. CLUSTERED tells SQL Server to create a clustered index with the key cust_id. That will turn it from a heap to a clustered index.

  • i dont understand what you said. I am a newbie. – superfast Jun 09 '12 at 09:18
  • LOL ! Unfortunately, my book uses those commands (to build the sample database) but does not even have notes for them. I cannot get another book immediately. Any good links/tutorials for these commands until i get another book ? – superfast Jun 10 '12 at 01:33
0

There are plenty resources online. You can start here: It should have most of the basics covered. Start form the basics, such as create database, create tables, select data from tables, etc. More advanced topics such as clustered indexes and With Non-check option will make it more confusing for you.

Void Ray
  • 9,849
  • 4
  • 33
  • 53