Erro na Procedure
07/07/2008
0
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
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
Curtir tópico
+ 0
Responder
Posts
09/07/2008
Emerson Nascimento
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
Responder
Clique aqui para fazer login e interagir na Comunidade :)