please give me the complete coding....?
I want to start auto incrment number start emp001,emp002...
identity column will work only for integer values. Suppose if I want to set id value starts from 08U13000 and increase that value based on new records inserted in table like 08U13000, 08U13001, 08U13002, etc…or emp01,emp02,emp03..........
Sanjeeb LenkaPosted Jul 11, 2013, 12:58 AM
create your table like this:
CREATE TABLE #tm(id INT NOT NULL IDENTITY(1,1),col AS '08U13'+RIGHT('000'+CAST(id AS VARCHAR(3)),3))
INSERT
INTO #tm DEFAULT VALUES
SELECT * FROM #tm
for checking i created a temp table and inserting default value . you can create your table like above .
Iftikar HussainPosted Jul 11, 2013, 12:33 AM
Here it is
Regards,
Iftikar
Sanjeeb LenkaPosted Jul 11, 2013, 12:26 AM
http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server
Jignesh TrivediPosted Jul 10, 2013, 11:16 PM
Please refer following forum in c# corner
http://beta.c-sharpcorner.com/Forums/Thread/163919/hi-how-to-auto-increment-for-text-and-char-in-sql-table.aspx
it might resolve your problem.