2016-06-23 57 views
0
CREATE PROCEDURE CUSTOMER 
    @LastName nvarchar(50) = NULL, 
    @FirstName nvarchar(50) = NULL 
AS 
BEGIN 
    SET NOCOUNT ON; 

    SELECT @LastName, @FirstName, 
    FROM CUSTOMER 
    WHERE FirstName = @FirstName AND LastName = @LastName 
END 
GO 
+1

對許多逗號? –

+0

那裏有多個錯誤。但錯誤消息是因爲@ @ FirstName後的逗號:'SELECT @LastName,@FirstName FROM .....' – Lamak

+0

謝謝。但是現在它說:消息2714,級別16,狀態3,過程CUSTOMER,行21 數據庫中已經有一個名爲'CUSTOMER'的對象。 – Gina

回答

0

是逗號!

試試這個:

CREATE PROCEDURE CUSTOMER 
    @LastName nvarchar(50) = NULL, 
    @FirstName nvarchar(50) = NULL 
AS 
BEGIN 
    SET NOCOUNT ON; 

    SELECT @LastName, @FirstName 
    FROM CUSTOMER 
    WHERE FirstName = @FirstName AND LastName = @LastName 
END 
GO 
+0

謝謝......現在它說:消息2714,級別16,狀態3,程序客戶,行21 數據庫中已經有一個名爲'CUSTOMER'的對象。 – Gina

+0

發生這種情況是因爲您的數據庫中已經存在名爲'CUSTOMER'的對象。檢查這一點,重命名你的過程,錯誤將消失。 –

相關問題