.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

autogenerated columns

Posted By: sidhu     Posted Date: November 26, 2010    Points:2   Category :Sql Server
Please tell Sql query for creating a table with autogenerated columns.

Responses
Author: Sajid P K             
Posted Date: November 26, 2010     Points: 5   

sidhu ,in this context what you mean by "autogenerated columns" ?

Author: SureshM             
Posted Date: December 03, 2010     Points: 5   

Hi, sidhu..
In the below code will explain how to create a table with auto generated columns.

IDENTITY key word used for create the auto generated column.

Values:(1,1) means, the column of the value is incremented 1 by 1.(1,2,3....)
if u assign (5,5) ..(5,10,15,20....)


CREATE TABLE [dbo].[tbl_Products](
[ProductId] [int] IDENTITY(1,1) NOT NULL,
[ProductName] [varchar](150) NOT NULL)

This will help u ..

Author: Maverick             
Posted Date: March 07, 2011     Points: 20   

Hello,

Use this

CREATE TABLE [dbo].[yourtable](
[AutoIncrementcolumn] [int] IDENTITY(1,1) NOT NULL,


Thanks,
Maverick

Thanks,
Maverick
Author: Narayanan             
Posted Date: July 13, 2011     Points: 20   

Hi,
try this
http://www.w3schools.com/sql/sql_autoincrement.asp

Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend