我是SQL Server的新手,并尝试编写一个存储过程,用于在调用存储过程时使用当前日期/时间更新记录集。我的代码会在=
附近报告错误。参数@SentFax
是需要更新的记录的PK,任何想法为什么不起作用?
CREATE PROCEDURE FaxMailerSent
-- Add the parameters for the stored procedure here
@SentFax int = 0,
=
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE FaxMailer
SET Done = GetDate()
WHERE [Fax_ID] = @SentFax;
END
GO
答案 0 :(得分:1)
删除,
之后的@SentFax int = 0
和=
与@SentFax int = 0
之间的AS
。
以下内容应按预期工作:
CREATE PROCEDURE FaxMailerSent
@SentFax int = 0
AS
BEGIN
SET NOCOUNT ON;
UPDATE FaxMailer
SET Done = GetDate()
WHERE [Fax_ID] = @SentFax;
END
GO
答案 1 :(得分:0)
尝试以下
CREATE PROCEDURE FaxMailerSent
-- Add the parameters for the stored procedure here
@SentFax int = 0
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE FaxMailer
SET Done = GetDate()
WHERE [Fax_ID] = @SentFax;
END
GO