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?what version of sql server is the problem in?
are there perhaps other owners of identically named tables?
for example, is there both a mauro.table and a dbo.table, where the
mauro.table has the b column and the dbo.table does not?
Mauro wrote:
> 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?
>
>
>|||2005., NO, the column does not exists in the whole server, in the 2000
server it works perfectly and in 2005 in another databases it also works
fine.
"Trey Walpole" <treypole@.newsgroups.nospam> wrote in message
news:Of%23ruGI7FHA.1028@.TK2MSFTNGP11.phx.gbl...
> what version of sql server is the problem in?
> are there perhaps other owners of identically named tables?
> for example, is there both a mauro.table and a dbo.table, where the
> mauro.table has the b column and the dbo.table does not?
> Mauro wrote:
not

No comments:

Post a Comment