Erro na Procedure

SQL Server

07/07/2008

Alguem poderia me explicar pq quando colocar o comando ´were´ nesse procedure da o seguinte erro:

No exemplo de baixo funciona corretamente

CREATE PROCEDURE SEQUENCIA
as
declare @Cont Int,
@Seq int
Set @Cont = 0
set @Seq = (Select Count(*) from CadMaterial)
if (@Cont<@Seq)
UpDate CadMaterial SET Aux = @Cont,
@Cont = @Cont + 1

GO
exec sequencia


Agora quando coloco o where no update da erro na variavel cont

´ncorrect syntax near ´@Cont´.´


CREATE PROCEDURE SEQUENCIA
as
declare @Cont Int,
@Seq int
Set @Cont = 0
set @Seq = (Select Count(*) from CadMaterial)
if (@Cont<@Seq)
UpDate CadMaterial SET Aux = @Cont
[b:0aea9bc981]where Aux<10;[/b:0aea9bc981],
@Cont = @Cont + 1

GO
exec sequencia


Marceloalmeidasantana

Marceloalmeidasantana

Curtidas 0

Respostas

Emerson Nascimento

Emerson Nascimento

07/07/2008

o were está no lugar errado.

CREATE PROCEDURE SEQUENCIA
as
begin
  declare @Cont Int,
  @Seq int
  Set @Cont = 0
  set @Seq = (Select Count(*) from CadMaterial)

  if (@Cont<@Seq)
    UpDate
      CadMaterial
    SET
      Aux = @Cont,
      @Cont = @Cont + 1
    where Aux < 10
end



GOSTEI 0
Marceloalmeidasantana

Marceloalmeidasantana

07/07/2008

Valewww cara funcionou. :D . Obrigadoooo


GOSTEI 0
POSTAR