ALTER PROCEDURE [dbo].[USP_INSERT_DATA]
@A1 VARCHAR(25),
@B1 VARCHAR(25)
AS
BEGIN
SET NOCOUNT ON;
IF (SELECT A, B
FROM TABLE
WHERE (A = @A)
AND (B = @B)) = 0 THEN
INSERT INTO TABLE(A,B) VALUES (@A, @B)
END IF
END
อันนี้เป็น Error ที่ระบบแจ้งมาครับ
Incorrect syntax near the keyword 'THEN'.
Incorrect syntax near the keyword 'END'.
Tag : .NET, Ms SQL Server 2008, C#, VS 2008 (.NET 3.x)
Date :
2013-06-03 09:56:14
By :
Agility
View :
1052
Reply :
1
No. 1
Guest
Code (SQL)
ALTER PROCEDURE [dbo].[USP_INSERT_DATA]
@A1 VARCHAR(25),
@B1 VARCHAR(25)
AS
BEGIN
SET NOCOUNT ON;
IF (SELECT COUNT(*) FROM TABLE WHERE A = @A AND B = @B) = 0
BEGIN
INSERT INTO TABLE(A,B) VALUES (@A, @B)
END
END