Hey Everyone,
I was wondering if anyone could provide a tutorial or example on how to create a stored procedure that uses delete cascade to delete records from 2 tables? i have seen examples online, but the ones i found online only show examples for if both tables have a field in common. My 2 tables have nothing in common with each other. An both are primary keys in there own table.Right now here is what i have for delete.I am using SQL Server 2005.
Thank you in advance,
Rach
I was wondering if anyone could provide a tutorial or example on how to create a stored procedure that uses delete cascade to delete records from 2 tables? i have seen examples online, but the ones i found online only show examples for if both tables have a field in common. My 2 tables have nothing in common with each other. An both are primary keys in there own table.Right now here is what i have for delete.I am using SQL Server 2005.
Code:
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go -- ============================================= . -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= CREATE PROCEDURE [dbo].[usp_CS_Deletesp] -- Add the parameters for the stored procedure here ( @pkb_fk_ticketNo nvarchar(100), @fk_ticketNo nvarchar(100)) AS DELETE FROM tbl_CS_serial WHERE pkb_fk_ticketNo=@pkb_fk_ticketNo DELETE FROM tbl_CS_parts WHERE fk_ticketNo=@fk_ticketNo
Rach
Comment