Delete From ReceiptDetail
Delete From ReceiptHeader


if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PK_ReceiptDetail]'))
ALTER TABLE [dbo].ReceiptDetail DROP CONSTRAINT PK_ReceiptDetail

if not exists (select * from dbo.sysobjects where Name ='FK_ReceiptDetail_ReceiptHeader')
ALTER TABLE [dbo].[ReceiptDetail]  WITH CHECK ADD  CONSTRAINT [FK_ReceiptDetail_ReceiptHeader] FOREIGN KEY([HeaderRowID])
REFERENCES [dbo].[ReceiptHeader] ([RowID])
ON DELETE CASCADE