I have always enjoyed writing about three topics Constraint and Keys, Backup and Restore and Datetime Functions.
Primary Keys constraints prevents duplicate values for columns and provides unique identifier to each column, as well it creates clustered index on the columns.
-- Primary Key Constraint upon Table Created Method 1
USE AdventureWorks
GO
CREATE TABLE ConstraintTable
(ID INT CONSTRAINT Ct_ID PRIMARY KEY, ColSecond INT)
GO
--Clean Up
DROP TABLE ConstraintTable
GO
-- Primary Key Constraint upon Table Created Method 2
USE AdventureWorks
GO
CREATE TABLE ConstraintTable
(ID INT, ColSecond INT,
CONSTRAINT Ct_ID PRIMARY KEY (ID))
GO
--Clean Up
DROP TABLE ConstraintTable
GO
-- Primary Key Constraint after Table Created Method 3
USE AdventureWorks
GO
CREATE TABLE ConstraintTable
(ID INT, ColSecond INT)
GO
-- Primary Key Column must not allow NULL
ALTER TABLE ConstraintTable
ALTER COLUMN ID INT NOT NULL
GO
ALTER TABLE ConstraintTable
ADD CONSTRAINT Ct_ID PRIMARY KEY (ID)
--Clean Up
DROP TABLE ConstraintTable
GO
Reference : Pinal Dave (http://www.SQLAuthority.com)






Hello Sir,
I am an aspiring DBA can u pls suggest me a book from where i can learn to administer both SQL Server 2005 and Oracle.
Thanking you in advance.
Amit
Hello Sir,
Wish U Very Very Happy Diwali
I Am Ashutosh Here Sir I Also Become a MCTS.Net & DBA so please can U Suggest Me Which books i should be read
Thank You Sir
Ashutosh Bagul
ur Advice is Valuable…DBA
ur Advice is Valuable…DBA
Do let me know presently m working in a bank as a Datavbase Administrator for Sql server 2005 though i dont have very much to do even nothing to explore my skills here …/…. i m trying to move on to devlopement company as soon as possible here i feel like standstill ……meanwhile do u think that i shud carry on with this job look though i m learning ———–indexing,Physical and logical data modeling—–Performance tunning of Queris and Database ,clustring knowledge.Troubleshooting of Queris and Procedures. at my own skills…..m only doing some backup statgies automating backup’s and maintainance plan and Using Dbcc commands replication and mirroring etc…
Do you think that it ll count as a experience for switching off to next company….
Please Plea advice me ……
Vaibhav mathur
Thanks :-)
it is very useful to beginers
hello sir
I have plan to do some project in inventary model for this I have created my database in sql 2005 as by back-end and c#.net is my front end for this i would like to know difference between the sql scripting language and ordinary database language plz help me…………..