Thursday, March 22, 2012

Changing the database Owner

Hi,
I have the problem changing the database onwer using sp_changedbowner. I
have a database TEST and owner it is shwing as userid/domain and in sysusers
in this database it showing sa as dbo. When I ran the sp_changedbowner sa ,
it is telling sa is already user in the database. I wnat to change this
database onwer to 'sa', can some tell how to do this.
Thnaks,
RbHow many rows does below return:
USE dbname
SELECT *
FROM sysusers su INNER JOIN master..syslogins AS sl ON su.sid = sl.sid
and sl.name = 'sa'
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"rb" <srbssr@.yahoo.com> wrote in message
news:uQ0A440uDHA.1224@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I have the problem changing the database onwer using sp_changedbowner. I
> have a database TEST and owner it is shwing as userid/domain and in
sysusers
> in this database it showing sa as dbo. When I ran the sp_changedbowner sa
,
> it is telling sa is already user in the database. I wnat to change this
> database onwer to 'sa', can some tell how to do this.
> Thnaks,
> Rb
>|||Tibor,
I am getting One row when I ran the query.
(1 row(s) affected)
Thanks,
RB
"Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
wrote in message news:%23mYyRd1uDHA.3536@.tk2msftngp13.phx.gbl...
> How many rows does below return:
> USE dbname
> SELECT *
> FROM sysusers su INNER JOIN master..syslogins AS sl ON su.sid = sl.sid
> and sl.name = 'sa'
> --
> Tibor Karaszi, SQL Server MVP
> Archive at:
>
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
>
> "rb" <srbssr@.yahoo.com> wrote in message
> news:uQ0A440uDHA.1224@.TK2MSFTNGP09.phx.gbl...
> > Hi,
> > I have the problem changing the database onwer using sp_changedbowner. I
> > have a database TEST and owner it is shwing as userid/domain and in
> sysusers
> > in this database it showing sa as dbo. When I ran the sp_changedbowner
sa
> ,
> > it is telling sa is already user in the database. I wnat to change this
> > database onwer to 'sa', can some tell how to do this.
> >
> > Thnaks,
> > Rb
> >
> >
>|||Then sa is already a user in the database. What username does it say?
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"rb" <srbssr@.yahoo.com> wrote in message
news:O0M9Gs2uDHA.2208@.TK2MSFTNGP10.phx.gbl...
> Tibor,
> I am getting One row when I ran the query.
> (1 row(s) affected)
> Thanks,
> RB
>
> "Tibor Karaszi"
<tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
> wrote in message news:%23mYyRd1uDHA.3536@.tk2msftngp13.phx.gbl...
> > How many rows does below return:
> > USE dbname
> > SELECT *
> > FROM sysusers su INNER JOIN master..syslogins AS sl ON su.sid = sl.sid
> > and sl.name = 'sa'
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > Archive at:
> >
>
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
> >
> >
> > "rb" <srbssr@.yahoo.com> wrote in message
> > news:uQ0A440uDHA.1224@.TK2MSFTNGP09.phx.gbl...
> > > Hi,
> > > I have the problem changing the database onwer using sp_changedbowner.
I
> > > have a database TEST and owner it is shwing as userid/domain and in
> > sysusers
> > > in this database it showing sa as dbo. When I ran the sp_changedbowner
> sa
> > ,
> > > it is telling sa is already user in the database. I wnat to change
this
> > > database onwer to 'sa', can some tell how to do this.
> > >
> > > Thnaks,
> > > Rb
> > >
> > >
> >
> >
>

No comments:

Post a Comment