gpt4 book ai didi

sql - 'end' 附近的语法不正确

转载 作者:行者123 更新时间:2023-12-04 01:48:35 24 4
gpt4 key购买 nike

<分区>

对于下面的存储过程,我得到一个错误

Incorrect syntax near 'end'

据我所知,我有正确的开始和结束标签。我不确定错误在哪里。我也检查了前面的问题,但无法纠正错误。感谢您的帮助!

USE CONTACT
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[Pref]
(@userName VARCHAR(50),
@ComputerName VARCHAR(50),
@PrinterDescription VARCHAR(255),
@PrinterLocation VARCHAR(255),
@Print_DuplexYN TINYINT,
@DateRecChanged datetime
)
AS
BEGIN
DECLARE @userID INT;

SELECT @userID = User_ID
FROM tblUser
WHERE Login_ID = @userName

DECLARE @MyCount INT

SELECT @MyCount = COUNT(UserName)
FROM PrinterPrefs
WHERE UserName = @UserName AND ComputerName = @ComputerName

IF @MyCount = 0
BEGIN
INSERT INTO PrinterPrefs (UserName, ComputerName, PrinterDescription, PrinterLocation, Print_DuplexYN, DateRecChanged)
VALUES (@UserName, @ComputerName, @PrinterDescription, @PrinterLocation, @Print_DuplexYN, getdate(), @UserName)
END
ELSE
BEGIN
UPDATE PrinterPrefs
SET PrinterDescription = @PrinterDescription,
PrinterLocation = @PrinterLocation,
Print_DuplexYN = @Print_DuplexYN,
DateRecChanged = getdate(),
UserName = @UserName
WHERE
UserName = @UserName AND
ComputerName = @ComputerName
END
GO

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com