Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Anand.A
Posting Yak Master
109 Posts |
Posted - 2012-02-21 : 03:10:47
|
| hii want to write a trigger thats populate batch id for my tableif today is start loading ie, monday my batchid should be 1so tomorrow my batchid should be 2, like this per day my batchid should be increament by 1.. how to write a trigger for thisanand |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2012-02-21 : 03:47:39
|
No need for trigger.Just add a DEFAULT value for your BatchID column something like thisALTER TABLE dbo.Table1 ALTER COLUMN BatchID DEFAULT DATEDIFF(DAY, '20120220', GETDATE()) N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|