aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Create Table in SQL Server with Primary Key and Identity (Autoincrement) Column in 2008

Aug 7, 2015

Here I will explain how to create table with primary key in
sql server or create table in sql server with primary key and identity or auto increment column with example. By setting column property like “UserID integer PRIMARY KEY IDENTITY” we can create primary key with identity column in sql server.

To create table with primary key and identity column we need to write the query like as shown below in sql server

Create Table UserDetails
UserName varchar(50),
Education varchar(50),
Location varchar(50)

When we run above query UserDetails table will create in database that would be like as shown below

Create Table in SQL Server with Primary Key and Identity (Autoincrement) Column in 2008

If you want to know more about primary key / foreign key / other key constraints check following article it’s having detailed explanation

I hope it helps you to create primary key / foreign key or any other required key in sql server

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.