であることBIGINT
を使用することができます。 GUIDの最大容量は2^128です。
CREATE TABLE IntegratorQueue(
ID UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(),--IDENTITY,
RefDetailId UNIQUEIDENTIFIER NOT NULL,
RefStartDate datetime
)
INT IDが最大値を超える時期を知る必要がある場合は、挿入前に確認する必要があります。たぶん、DBCC CHECKIDENT(テーブル名、RESEED、currentseed +挿入)
INSERT INTO IntegratorQueue(RefDetailId, RefStartDate)
VALUES (NEWID(), GETUTCDATE())
-- INT capacity (-2,147,483,648) to (2,147,483,647)
IF 2147483647 - SCOPE_IDENTITY() < 500000
--... Do something... send an Email (xp_sendmail. http://msdn.microsoft.com/en-us/library/aa260697(v=sql.80).aspx)
-- Insert Notification records into an another table...
-- return with 1, or something else, like the end of your query instead of RETURN 0 RETURN 1 and check this... so on...
はいDBCCのCHECKIDENTは私が思うにこれを扱うためにもっと気に入っています.... ID値がUIで使用されるので、私はそれがintであることを好みました。 – dankyy1