我使用以下命令來執行存儲過程,但刪除不會運行。問題是什麼?刪除在存儲過程中不起作用
exec sp_delete 'fruits', '''1.5'',''3.5'''
sp_delete
CREATE PROCEDURE [dbo].[sp_delete]
@stock_type VARCHAR(255)
,@weight VARCHAR(255)
AS
IF @stock_type ='fruits'
BEGIN TRY
IF EXISTS(SELECT * FROM tblshop WHERE quantity='1' and weight in (@weight))
BEGIN
DELETE FROM tblshop WHERE quantity='1' and weight in (@weight)
END
END TRY
BEGIN CATCH
END CATCH
不給程序 「以sp_」 前綴http://sqlperformance.com/2012/10/t-sql-queries/sp_prefix – GuidoG
這裏https://開頭MSDN .microsoft.com/en-us/library/ms190669(v = sql.105).aspx#命名%20Stored%20過程 – GuidoG
SQL Server不支持宏替換...(@weight)中的權重) –