我正在向SQL存儲過程發送2個參數。它可以工作,但是當我嘗試連接一個局部變量時,它不會。將局部變量連接到參數
這工作:
exec DeansSMSDB.dbo.ADD_SMS_InQueue @CellNo, 'Dear customer, Your complaint has been registered and your complaint no. is'
但這並不:
exec DeansSMSDB.dbo.ADD_SMS_InQueue @CellNo, 'Dear customer, Your complaint has been registered and your complaint no. is' + @ComplaintID
我需要連接@ComplaintID,但如何?
如果您查看['EXECUTE'](http://msdn.microsoft.com/en-gb/library/ms188332.aspx)的語法,您會看到您可以提供*值*或a *變量*。什麼不是(如果你試圖允許的話)會是*表達式*。 –