sql 将查询返回的列数赋值给变量i
DECLARE@vnvarchardeclare@iintBEGINSET@i=(SELECTcount*fromp)while@i>0SET@v=SELECTp.PIN...
DECLARE @v nvarchar declare @i int BEGIN SET @i =(SELECT count * from p) while @i >0 SET @v = SELECT p.PINming FROM p WHERE p.id = @i UPDATE mm1.ff12 = '1' WHERE mm1.ff14 LIKE % @v % SET @i = @i - 1 END
展开
1个回答
展开全部
DECLARE @v NVARCHAR
DECLARE @i int
BEGIN
SELECT @i=COUNT(*) from p
while @i >0
BEGIN
SELECT @v=p.PINming FROM p WHERE p.id = @i
UPDATE mm1.ff12 = '1'
WHERE mm1.ff14 LIKE % @v %
SET @i = @i - 1
END
END
while不加begin end的话,默认之后执行 while下的第一行
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询