0
如何比較變量@PersoanaAnterioara
和@PersoanaCurenta
? '@PersoanaCurenta'.--errorSQL Server在比較兩個變量時出錯
不正確的語法
drop table #MyTmpData DECLARE @PersoanaCurenta nvarchar(100), @PersoanaAnterioara nvarchar(100), @Cunostinte nvarchar(50), @CunostinteTotale nvarchar(max) , @ok int select row_number() over (order by persoana) as RowID, a.* into #MyTmpData from ex..tpersoane a Declare @Step int Declare @count int set @count=(select count(RowId) from #MyTmpData) set @Step = 0 set @ok=0 set @PersoanaCurenta=null set @PersoanaAnterioara=null while (@count > @Step) BEGIN SET @Step = @Step + 1 select @PersoanaCurenta=persoana , @Cunostinte = cunostinte from #MyTmpData where @Step=RowID if @PersoanaAnterioara is not null and @PersoanaAnterioara != @PersoanaCurenta end
附近有語法錯誤@PersoanaCurenta「。
'@PersoanaAnterioara!= @PersoanaCurenta'是有效的語法進行比較。 'IF'條件中缺少'Statement' –