How to get recordset in SQL Server 2000 and assign it to variable?About trigger
I need to retrieve total record in a table with Transact-SQL within SQL Server 2000.
For some reason I have to use the SQL:
exec('select count(*) from'+@tablename)
But I don't know how to assign it to a variable in SQL Server 2000(Not in client-side application).
I am developing database application.I must retrieve date and conjuction it with one number to form YYMMDDID.
For example:today is 2003-1-27.and the last record is 200301270005, then the next record today must be 200301270006.And I dont know the real @tablename which is a parameter.The best way is to create a trigger.
So what can I do?
By the way, when the record is triggered can I update the record?If I can how to do it?
thanks a lot.

