Showing posts with label target. Show all posts
Showing posts with label target. Show all posts

Tuesday, February 14, 2012

Changing DB Owner

Inadvertantly I moved several DB's from one SQL box to another however when
I reattached the DB's onte Target server I was logged in as the incorrect
user so the DB Owner shows up as my personal login and not the
Domain\SQLAdmin user which we are supposed to perform maintanence under
(oops). I suspect things worked because my login ID is domain admin. I did
find the command sp_changedbowner however I think it only works with SQL
users and not Windows Domain users. If this is correct could some one
please send/post the exact syntax to change the DB owner from Domain\mylogin
to Domain\SQLAdmin? Thanks!sp_changedbowner ought to work with both Windows and SQL logins. The
specified login must not already be a user in the database. Examples below.
--standard login
USE MyDatabase
EXEC sp_changedbowner 'SQLAdmin'
--Windows login
USE MyDatabase
EXEC sp_changedbowner 'Domain\SQLAdmin'
Hope this helps.
Dan Guzman
SQL Server MVP
"Mike B." <Autobahn97@.hotmail.com> wrote in message
news:e$ytVNFhEHA.3428@.TK2MSFTNGP11.phx.gbl...
> Inadvertantly I moved several DB's from one SQL box to another however
when
> I reattached the DB's onte Target server I was logged in as the incorrect
> user so the DB Owner shows up as my personal login and not the
> Domain\SQLAdmin user which we are supposed to perform maintanence under
> (oops). I suspect things worked because my login ID is domain admin. I
did
> find the command sp_changedbowner however I think it only works with SQL
> users and not Windows Domain users. If this is correct could some one
> please send/post the exact syntax to change the DB owner from
Domain\mylogin
> to Domain\SQLAdmin? Thanks!
>

Changing DB Owner

Inadvertantly I moved several DB's from one SQL box to another however when
I reattached the DB's onte Target server I was logged in as the incorrect
user so the DB Owner shows up as my personal login and not the
Domain\SQLAdmin user which we are supposed to perform maintanence under
(oops). I suspect things worked because my login ID is domain admin. I did
find the command sp_changedbowner however I think it only works with SQL
users and not Windows Domain users. If this is correct could some one
please send/post the exact syntax to change the DB owner from Domain\mylogin
to Domain\SQLAdmin? Thanks!
sp_changedbowner ought to work with both Windows and SQL logins. The
specified login must not already be a user in the database. Examples below.
--standard login
USE MyDatabase
EXEC sp_changedbowner 'SQLAdmin'
--Windows login
USE MyDatabase
EXEC sp_changedbowner 'Domain\SQLAdmin'
Hope this helps.
Dan Guzman
SQL Server MVP
"Mike B." <Autobahn97@.hotmail.com> wrote in message
news:e$ytVNFhEHA.3428@.TK2MSFTNGP11.phx.gbl...
> Inadvertantly I moved several DB's from one SQL box to another however
when
> I reattached the DB's onte Target server I was logged in as the incorrect
> user so the DB Owner shows up as my personal login and not the
> Domain\SQLAdmin user which we are supposed to perform maintanence under
> (oops). I suspect things worked because my login ID is domain admin. I
did
> find the command sp_changedbowner however I think it only works with SQL
> users and not Windows Domain users. If this is correct could some one
> please send/post the exact syntax to change the DB owner from
Domain\mylogin
> to Domain\SQLAdmin? Thanks!
>

Sunday, February 12, 2012

Changing DB Owner

Inadvertantly I moved several DB's from one SQL box to another however when
I reattached the DB's onte Target server I was logged in as the incorrect
user so the DB Owner shows up as my personal login and not the
Domain\SQLAdmin user which we are supposed to perform maintanence under
(oops). I suspect things worked because my login ID is domain admin. I did
find the command sp_changedbowner however I think it only works with SQL
users and not Windows Domain users. If this is correct could some one
please send/post the exact syntax to change the DB owner from Domain\mylogin
to Domain\SQLAdmin? Thanks!sp_changedbowner ought to work with both Windows and SQL logins. The
specified login must not already be a user in the database. Examples below.
--standard login
USE MyDatabase
EXEC sp_changedbowner 'SQLAdmin'
--Windows login
USE MyDatabase
EXEC sp_changedbowner 'Domain\SQLAdmin'
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Mike B." <Autobahn97@.hotmail.com> wrote in message
news:e$ytVNFhEHA.3428@.TK2MSFTNGP11.phx.gbl...
> Inadvertantly I moved several DB's from one SQL box to another however
when
> I reattached the DB's onte Target server I was logged in as the incorrect
> user so the DB Owner shows up as my personal login and not the
> Domain\SQLAdmin user which we are supposed to perform maintanence under
> (oops). I suspect things worked because my login ID is domain admin. I
did
> find the command sp_changedbowner however I think it only works with SQL
> users and not Windows Domain users. If this is correct could some one
> please send/post the exact syntax to change the DB owner from
Domain\mylogin
> to Domain\SQLAdmin? Thanks!
>

Friday, February 10, 2012

Changing database collation problem in SQL Server 2000

Hello...

When I migrated data from one SQL Server to another I got collection problems because collation of the target server was different from the source one.

The best solution I thought about was to change collation of the database in target server to be equal to the server collation so that when a temporary table is created, and the collation used would be the server collation, no error would occur. All sounds logic, but, after I ran ALTER DATABASE command and changed the collation of the database, I verified that all varchar fields of all database tables retained the old collation, not the new database collation I set.

Is there any way to change the collation of all fields at once when I change the database collation?

Thanks for your help

Jaime

All that happens when you execute the ALTER DATABASE statement is that you set the NEW default for any NEW tables.

If you want to change the existing tables, you will have have to change each (n)varchar and text column -one at a time.

ALTER TABLE MyTable

ALTER COLUMN MyColumn COLLATE NewCollation