0

我是 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
4

2 回答 2

1

删除,after@SentFax int = 0=between @SentFax int = 0and AS

以下应该按预期工作:

CREATE PROCEDURE FaxMailerSent 
    @SentFax int = 0
AS
BEGIN
SET NOCOUNT ON;

UPDATE FaxMailer 
    SET Done = GetDate()
        WHERE [Fax_ID] = @SentFax; 
END
GO
于 2013-06-09T19:08:29.630 回答
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
于 2013-06-09T19:10:51.730 回答