Friday, March 9, 2012

how to Drop an orphan view

Hi...
I have this in SQL Server 2000:
select * from sysobjects where name = 'xView' -- returns a row
-- but if I exec this script:
select * from xView
-- return to me
Mens. 208, Levl 16...
Object 'xView' is not valid.
The problem is I need to drop the login xLogin who is the xView owner.
Hw i do? why occurs this....thanks in advance.
--
ChevyHi Chevy,
Does
select * from xLogin.xView
works?
If that works then you can drop the view or change its ownership using
sp_changeobjectowner. Then drop the login.
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"Chevy" wrote:
> Hi...
> I have this in SQL Server 2000:
> select * from sysobjects where name = 'xView' -- returns a row
> -- but if I exec this script:
> select * from xView
> -- return to me
> Mens. 208, Levl 16...
> Object 'xView' is not valid.
> The problem is I need to drop the login xLogin who is the xView owner.
> Hw i do? why occurs this....thanks in advance.
> --
> Chevy|||Chevy,
There probably is an object named 'xView', but it is not a view. If you try
the following, you will get the same error.
use master
select * from sp_who
If you query the system table you should do:
select * from sysobjects where name = 'xView' and type = 'V'
Or use the INFORMATION_SCHEMA views.
RLF
"Chevy" <Chevy@.discussions.microsoft.com> wrote in message
news:B6935BD1-F6A2-4980-9521-A9E064CAABFA@.microsoft.com...
> Hi...
> I have this in SQL Server 2000:
> select * from sysobjects where name = 'xView' -- returns a row
> -- but if I exec this script:
> select * from xView
> -- return to me
> Mens. 208, Levl 16...
> Object 'xView' is not valid.
> The problem is I need to drop the login xLogin who is the xView owner.
> Hw i do? why occurs this....thanks in advance.
> --
> Chevy|||Yes Ben, you are rigth...I was really blind...thanks
___________
Chevy
"Ben Nevarez" wrote:
> Hi Chevy,
> Does
> select * from xLogin.xView
> works?
> If that works then you can drop the view or change its ownership using
> sp_changeobjectowner. Then drop the login.
> Hope this helps,
> Ben Nevarez
> Senior Database Administrator
> AIG SunAmerica
>
> "Chevy" wrote:
> > Hi...
> >
> > I have this in SQL Server 2000:
> >
> > select * from sysobjects where name = 'xView' -- returns a row
> >
> > -- but if I exec this script:
> >
> > select * from xView
> >
> > -- return to me
> >
> > Mens. 208, Levl 16...
> > Object 'xView' is not valid.
> >
> > The problem is I need to drop the login xLogin who is the xView owner.
> >
> > Hw i do? why occurs this....thanks in advance.
> >
> > --
> > Chevy

No comments:

Post a Comment