DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: iNCREMENT IN SQL SERVER

  1. #1
    Join Date
    Feb 2001
    Posts
    17
    HOW DO I GIVE INCREMENT VALUE IN THE PROCEDURE? I AM USING SQL SERVER 7.0

  2. #2
    Join Date
    Nov 2000
    Posts
    15
    Are you referring to incrementing a unique row identifier as in an Oracle sequence? If so, SQL Server uses an identity function that is defined for a column at table creation. The identity column autoincrements as each new row is inserted into the table.
    Michael Auer
    Oracle DBA/Developer
    Oracle8i OCP

  3. #3
    Join Date
    Feb 2001
    Posts
    17
    hi micheal,

    i tried it but i am getting the following message. i did it creation of table level only. i want to use the column at the procedure and increment a column at table level.

    - Unable to modify table.
    ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'ResponseID', table 'new sugar.dbo.Tmp_TenderApproval'; column does not allow nulls. INSERT fails.
    [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated.

    regards
    ravi

  4. #4
    Join Date
    Jan 2001
    Posts
    318
    One can have only one Identity column in SQl server which is usually Primary key which obviously does not accept null.
    From the error looks like this is not a Primary key column for you and you still want to increment it automatically and is defined as not null.
    Are you trying to generate a number for non Primary key column ???
    Sonali

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width