Insert auto Number in SQLSERVER

To insert unique serial numeric values to an SQL table usually DBAs rely on procs with loops and inside loop an incrementing variable substitutes numeric values

this may query time out., will consume mush significant time and may cause intermediate termination

to resolve this issue in SQL Server us the following query

suppose there is one table called customers and we need to back it up to  table customer_backup

insert into customers_backup
select cust_name,join_date,row_number() over (order by join_date)  from customers

  • Meet Author

    S.Abhilash, started this blog in the later half of 2009 as a self hosting site for all his previous blogging attempts. , My way of writing and frequency of publishing may not be uniform as my resources are my projects nd issues i came across. For the last few years this blog is reacing 100 s of unique visitors each day, thanks wordpress and google for such a perfection in their software and services.

    Head to Authors Page | Abhilash on Facebook



Category MSSQL Server     Tags , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Comment on Facebook

2 Comments to “Insert auto Number in SQLSERVER”

  • Mb from Washington, DC, United States March 3, 2011 at 2:20 AM

    The title of this article is misleading. It does NOT have to do at all with SQL Bulk Insert

Community



FREE News Letter

Enter your email address

See Also

  • Trace Phone Numbers in india

      Suppose you got a miss cal from number +9847XXXXXX, how will you trace the number at the moment ?, [...]

    (No Comments)

  • MAC OSX lion

      MAC OSX lion is the 18th release of MAC OSX. it supports both server and desktop environments as of [...]

    (No Comments)

  • SQL Server Aggregate Functions

    Aggregate Functions  in SQL server includes Count Max Min Sum Avg Suppose a table named Table1 id     name [...]

    (No Comments)

Resources

Please Submit your Email Address to Get Latest Technology News As it Happens


Enter your email address


Read previous post:
Yum Failed on Php Module installations

Yum is simply great over rpm in resolving dependancies , but atleast for some cases it failed annonymously and no...

Close