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
类型的记录。
不错,所有的方式都工作:) –