Tuesday, June 21, 2011

Constraint Naming Conventions

Check Key Constraints => CK_ParentTable_Column
E.g.: CK_Employee_EmployeeId

Default Key Constraints => DF_ParentTable_Column
E.g.: DF_Employee_EmployeeId

Foreign Key Constraints => FK_ParentTable_ChildTable_Column
E.g.: FK_Employee_Job_EmployeeId

Primary Key Constraints => PK_ParentTable_Column
E.g.: PK_Employee_EmployeeId

Unique Key Constraints => IX_ParentTable_Column
E.g.: IX_Employee_Email


CREATE TABLE SYNTAX
CREATE TABLE employee (
EmployeeId INT NOT NULL IDENTITY(1, 1),
FirstName VARCHAR(255),
LastName VARCHAR(255),
Email VARCHAR(255) CONSTRAINT IX_Employee_Email UNIQUE
)

ALTER TABLE SYNTAX
ALTER TABLE employee
ADD CONSTRAINT IX_Employee_Email UNIQUE(Email)

For more info on constraints and constraint naming please refer to the following links:
http://msdn.microsoft.com/en-us/library/ms174979.aspx
http://blog.sqlauthority.com/2007/02/05/sql-server-primary-key-constraints-and-unique-key-constraints/
http://msdn.microsoft.com/en-us/library/ms177420.aspx

Friday, January 7, 2011

Google Apps made easy

There is a nice way of using Google Mail and Calendar if you are using Chrome as a browser.

Step 1.
Install Chrome (if you have not yet... you probably cannot... or no one has told you how much better it is)

Step 2.
Download this and install this little application.
http://dl.google.com/tag/s/ap=mydomain.com/googlewebapps/en/googleappsstandalonesetuptagged.exe

You are done!
What you get is a separate window for your Email and Calendar.., which makes life so much easier...

Once you run this.. it looks like this:



And it looks like this:



Credit goes to Gerhard Pretorius for this useful post.