hi friends..
I m using sql server 2008...i m not able to set two auto-increment columns in my table..... Any suggestion please....
Its Urgent...........
Thanks in Advance......................
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nigel FernandesPosted Dec 22, 2016, 12:45 AM
Inathi GqolaPosted Jul 6, 2015, 10:21 AM
Anil KumarPosted May 29, 2012, 9:27 AM
For Other Column, you can do it by making this column as Compute column. Also you can write Trigger for the same. Easiest and Efficient would be Computed column.
You can create compute column as:
CREATE TABLE myTableName
(
GRNo INT IDENTITY(1,1) NOT NULL,
SecondColumnName VARCHAR(100),
OtherColumnsName VARCHAR(100),
BillNo AS ( 'B' + CAST( GRNo AS varchar(max) ) ) -- filling the value by computing B1 if GRNo is 1
-- OR Simply
-- BillNo AS (GRNo ) -- filling with GRNo
)
Same thing you can do from Design Mode of your table.
sathish kumarPosted May 29, 2012, 7:14 AM
is there any other way to do so......
brunda kPosted May 29, 2012, 6:54 AM
sathish kumarPosted May 29, 2012, 6:31 AM
Blocked AccountPosted May 29, 2012, 6:24 AM
You can't define two identity column in a single table.
Thanks
Manish