Hi,
I am new to SQL. I have a stored proc like this:
CREATE PROCEDURE [dbo].[Developer_Set]
(
@ID INT,
@UserID INT,
@EffectiveDate DATETIME,
@EndDate DATETIME = NULL,
@UserName VARCHAR(255)
)
AS
BEGIN
SET NOCOUNT ON;
UPDATE Developer
SET DeletionIndicator = 1
WHERE ID = @ID AND UserID = @UserID
INSERT INTO dbo.Developer
( ID ,
UserID ,
EffectiveDate ,
EndDate ,
DeletionIndicator
)
VALUES ( @ID ,
@UserID ,
@EffectiveDate,
@EndDate,
CASE WHEN @EndDate IS NULL THEN 0 ELSE 1 END
)
END
GO
I wanted to include a Where Statement like this :
INSERT INTO dbo.Developer
( ID ,
UserID ,
EffectiveDate ,
EndDate ,
DeletionIndicator
)
VALUES ( @ID ,
@UserID ,
@EffectiveDate,
@EndDate,
CASE WHEN @EndDate IS NULL THEN 0 ELSE 1 END
) Where ID= @ID
Why am i not able to do this?Please help.