61 lines
1.9 KiB
Transact-SQL
61 lines
1.9 KiB
Transact-SQL
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_CustomerDetailsDelete]') AND type in (N'P', N'PC'))
|
||
DROP PROCEDURE [dbo].[sp_CustomerDetailsDelete]
|
||
GO
|
||
SET ANSI_NULLS ON
|
||
GO
|
||
SET QUOTED_IDENTIFIER ON
|
||
GO
|
||
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_CustomerDetailsDelete]') AND type in (N'P', N'PC'))
|
||
BEGIN
|
||
EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[sp_CustomerDetailsDelete] AS'
|
||
END
|
||
GO
|
||
|
||
ALTER PROCEDURE [dbo].[sp_CustomerDetailsDelete]
|
||
@Name nvarchar(255) = null
|
||
,@errorNumber int output
|
||
,@errorMessage nvarchar(250) output
|
||
AS
|
||
BEGIN
|
||
SET NOCOUNT ON;
|
||
set @errorNumber = 0
|
||
set @errorMessage = space(0)
|
||
|
||
declare @CustomerId int
|
||
|
||
set @CustomerId = dbo.foo_IdGetCustomer(@Name)
|
||
|
||
delete from [dbo].[CustomerDetails] WHERE @Name is null or [CustomerId] = @CustomerId
|
||
END
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
GO
|