Following sample generates uniqueid but does not store in a table.
DECLARE @IntTransactionID bigint, --Set @IntTransactionID@dteCurrentDate datetime
SET @dteCurrentDate = GETDATE()
--Genreate unique transaction id
SET @IntTransactionID = CAST(CAST(@@SPID AS VARCHAR(10)) +...