0
我想將表格的結果存儲在變量中。我知道結果總是一列和一個記錄。這裏是我的代碼:將結果存儲在變量ms中sql
if ((select count(id) from Categorie where naam = 'Hobbyclub') = 1)
begin
declare @id int set select id from Categorie where naam = 'Hobbyclub';
insert into Items(naam, categorieID) values ('Naaien', @id);
print 'ok';
end
else
print 'nok';
它提供了以下關鍵字set
附近錯誤:
不正確的語法
我如何可以存儲在@id
第一個記錄,第一列存儲。
注意categorieID
(由insert
語句)也與int
類型的記錄。
不錯,所有的方式都工作:) –