i want to generate id column values on the basis of every day.
suppose table name like test and table have column id then value of id column are
today is 28-aug-2012 then values are increased after each insert like this :- table name test
column name ID and values are
id 2012082800001 2012082800002 .... .... 2012082800002 and next day it will be on new insert :- 2012082900001 2012082900002 ....... ........ and next day it will be on new insert :- 2012083000001 2012083000002 ....... ........
Split into two columns - you can use a calculated column to combine them if you wish. Then yoou can use a trigger to get the max value for a day and add one t oit.
You could do that with the current data but it's poor design. coalesce((select max(id)%100000 from tbl where id > convert(varchar(8),getdate(),112)*100000)+1,convert(varchar(8),getdate(),112)*100000+1)
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.
Easier than I posted? Don't think it's possible to get much easier given the structure.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.