Wednesday, March 28, 2012

if exists

i have this:
if exist(select * from sysobjects where name= 'table' and type = 'u' )
begin
update table set a=1 where b=2
end
and its giving me an
"INVALID COMUN NAME B" error,because of course it does not exists
but in sql 2000 its works perfectly, i noticed that in 2005 on another
databases iit also works fine,
why is it entering if the "if "is not true, and why in my database and not
the others?
could this be a BUG?Does column b exist int able youy are trying to update?
--
Paul Zanbaka
Sharepoint Adminstrator and DBA
www.mycodekb.com
"Mauro" <msbrizuela@.gmail.com> wrote in message
news:%23JWNhRH7FHA.1416@.TK2MSFTNGP09.phx.gbl...
>i have this:
> if exist(select * from sysobjects where name= 'table' and type = 'u' )
> begin
> update table set a=1 where b=2
> end
> and its giving me an
> "INVALID COMUN NAME B" error,because of course it does not exists
> but in sql 2000 its works perfectly, i noticed that in 2005 on another
> databases iit also works fine,
> why is it entering if the "if "is not true, and why in my database and not
> the others?
> could this be a BUG?
>
>
>

No comments:

Post a Comment