DotNet Solution

  • Home
  • Asp.net
    • Controls
    • DataControl
    • Ajax
  • Web Design
    • Html
    • Css
    • Java Script
  • Sql
    • Queries
    • Function
    • Stored Procedures
  • MVC
    • OverView
    • Create First Application
  • BootStrap
    • Collapse Function

Friday, 25 November 2016

Auto Increment Id in Sql Server

  Unknown       12:13       Queries       No comments    

SQL server identity column values use in table

Steps-Firstly Open-> Sql Server Create Table -> First Field Like ID Usually Autoincrement=>
Table create then=>insert data in table=> then Select data show increment id.

The following SQL statement defines the "ID" column to be an auto-increment primary key field in the "Category" table (Given Category is Table Name and CategoryId And  CategoryName are Field  in Table

         Create table Category
             (
                   CategoryId INT IDENTITY(1,1) Primary Key,
                   CategoryName NVARCHAR(100)     
             )

  We use IDENTITY(1,1) in Table .
Where the 1,1 is the starting number is 1 and increment  by 1 that's the resion We use Identity(1,1)


In the example above, the starting value for IDENTITY is 1, and it will increment by 1 for each new record.
Exp. To specify that the "ID" column should start at value 10 and increment by 5, change it to IDENTITY(10,5).

Result-



   In This Following Image CategoryId Is Auto Increment And Id id Start with 1 and It Will 
    Increment By 1
    
  Use This Steps In Result-

  1. Create Table With Create Query.

  2. Insert Data With Insert Query.

  3.  Show Table Data Through Select Query in Sql Server.




  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
Email This BlogThis! Share to X Share to Facebook
Newer Post Older Post Home

0 comments :

Post a Comment

Popular Posts

  • Auto Increment Id in Sql Server
    SQL server identity column values use in table Steps- Firstly Open-> Sql Server Create Table -> First Field Like ID Usually Autoi...
  • Open First Application in MVC
    How To Create First Application in MVC.Follows Some Steps-    STEP 1 . Firstly Go Start menu in Computer And Click on Installed Visual s...
  • Email Validation In JavaScript
    We use Validation for Email  in Javascript like in above example <!DOCTYPE html> <html> <head> <script> fu...
  • Asp.net- MultiView
    MultiView and View controls allow you to divide the content of a page into different groups, displaying only one group at a time. Each Vie...
  • The Evolution of MVC
    Microsoft had introduced ASP.NET MVC in .Net 3.5,since then lots of new features have been added.The following table list brief history of ...
  • Collapse Function Use in Bootstrap.
    Defination  1.  Collapse Means suddenly fall down. 2.  Just add data-toggle="collapse" and a data-target to element to ...
  • Install Visual Stdio Step by Step Process
    How to install visual studio 2015 Step by Step Process like => Step   (1) : Once downloading is complete, run the installer. The f...
  • Numeric Value Validation Through JavaScript
    Validate Only Numeric Value Enter In TextBox Using JavaScript function Firstly Write Java Script Function in <head tag> in Asp.Net ...
  • Javascript Regular Expression Email Validate
    Validate Email using Regular Expression In JavaScript- 1. Create Input type Text box and and onclick cal  checkemail function of Javascr...
  • MVC vs ASP.NET
    There are various positive points to Using MVC 1.  TDD support out of the box as most of the design is based on interfaces. 2.  SEO fr...

Blog Archive

  • ▼  2016 ( 36 )
    • ►  February ( 1 )
    • ►  March ( 5 )
    • ►  April ( 1 )
    • ►  June ( 10 )
    • ►  July ( 6 )
    • ▼  November ( 8 )
      • Get Random Rows in SqlServer
      • MVC OverView
      • Main Advantage Of MVC
      • MVC vs ASP.NET
      • The Evolution of MVC
      • MVC Framework Architecture
      • Auto Increment Id in Sql Server
      • Install Visual Stdio Step by Step Process
    • ►  December ( 5 )
  • ►  2017 ( 1 )
    • ►  January ( 1 )
Powered by Blogger.

Categories

  • Ajax
  • AllFunction
  • Controls
  • CreateApplication
  • css
  • Function
  • javascript
  • Js
  • over view
  • OverView
  • Queries
  • StoredProcedures

Text Widget

Sample Text

Pages

  • Home

Copyright © DotNet Solution | Powered by Blogger
Design by Vibha Acharya