开发者

Adding a foreign key constraint fill up my transaction log

When trying to add a foreign key constraint on an existing table in SQL Server 2000, I get an error message saying that the transaction log is full. What are the possible reasons why data is being added to the transaction 开发者_Python百科log when a foreign key constraint is being created and what remedy can I apply to each of these reasons? Also, if multiple reasons exist, how can I diagnose which of those reasons are relevant to me?

The script causing the error is a simple one that follows this pattern:

ALTER TABLE [dbo].[tableName] ADD
CONSTRAINT [key_name] FOREIGN KEY
(
    [columnId]
) REFERENCES [dbo].[otherTableName] (
    columnId
)
GO


It turns out that the log was being filled from a previous statement - one that modifies a column on a large table. Adding the foreign key constraint was just the straw that broke the camel's back.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜