Hi : I'm new to SQL triggers and stored procs so I would really appreciate
any help.
This is situation :
I have several tables. Each table has an ID field (long int) that needs to
be unique, in the whole database (not just in each individual table). I have
a table with a single record and a single field (Called UNiqueID).
When I execute an insert on any table I need to increment the current value
in the UNiqueID table UniqueId field and place this new value in the ID
field of the table on which the insert is being executed. I want to do this
using stored procedures and triggers mainly for performance considerations.
I can create a stored procedure GetUniqueID
CREATE PROCEDURE GetNewId AS Update UniqueId Set UniqueId = UniqueId + 1
This procedure only updates the current value in the UniqueId table, How do
I get this new value back to the trigger?
CREATE TRIGGER NEWID ON MYTABLE FOR INSERT AS ....... here I think I should
execute the GETNEWID Stored procedure.
Any help would be greatly appreciated.