General information
Forum:
Microsoft SQL Server
Thanks Michael and Bob for reply!
I came up with another solution very similar as your. I create a Sql statement in the insert trigger to know the last print I made, then I compare this date with the cuurent date, if both are the same then I just insert a row else I reset the counter and insert the row.
Select Top 1 max(PrintDate) as OldDate from myTable order by PrintDate Desc
if DateDiff(dd, GetDate(), OldDate) = 0
Exec spInsertSerialNumber
else
DBCC CheckIdent(MyTable, ReSeed, 0)
Exec spInsertSerialNumber
Thanks so much!
Martin Alcaraz
malcaraz@rtn.uson.mx
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only