Feeds:
Posts
Comments

Archive for the ‘SQL Constraint and Keys’ Category

After reading my earlier blog post SQL SERVER – Prevent Constraint to Allow NULL. I recently received question from user regarding how to alter the constraint. No. We cannot alter the constraint, only thing we can do is drop and recreate it. Here is the CREATE and DROP script. CREATE DATABASE TestDB GO USE TestDB [...]

Read Full Post »

With naked eyes, we often spot the evident problems but the specific details are missed many a time. Something similar happened recently. One of the blog readers sent me an email asking about a bug in how CHECK CONSTRAINT works. He suggested that check constraint accepts NULL even though the rule is specified. After looking [...]

Read Full Post »

Earlier today, I received following email. “Dear Pinal, We looked at your script and found out that in your script of disabling indexes, you have only included selected non-clustered index during the bulk insert and missed to disabled all the clustered index. Our DBA [name removed] has changed your script a bit and included all [...]

Read Full Post »

I think the title is clear what I am going to write in your post. This is age old problem and I want to compile the list stating advantages and disadvantages of using GUID and INT as a Primary Key or Clustered Index or Both (the usual case). Let me start a list by suggesting [...]

Read Full Post »

It is interesting how sometimes the documentation of simple concepts is not available online. I had received email from one of the reader where he has asked how to create Primary key with a specific name when creating the table itself. He said, he knows the method where he can create the table and then [...]

Read Full Post »

Older Posts »

Follow

Get every new post delivered to your Inbox.

Join 15,916 other followers