Author |
Topic |
waveform
Yak Posting Veteran
93 Posts |
Posted - 2011-12-06 : 07:18:15
|
Hi, in SQL2000, I was able to change the owner of a table by doing the following:sp_changeobjectowner [dbo.my_table_name], [my_db_user_name] However in SQL2008, trying to do the same thing, it comes up with the error:quote: Database principal or schema 'my_db_user_name' does not exist in this database
However it does exist, as my application logs in with it. I'm attempting to change the owner from "dbo" to my user name, before uploading the database to my web host. Is there some kind of prefix or something I need to use when specifying the new owner in SQL2008? |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-06 : 07:38:18
|
whats the schema the user is mapped to in sql 2008?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
waveform
Yak Posting Veteran
93 Posts |
Posted - 2011-12-06 : 08:53:23
|
Sorry, how do I find that out in SSMS? :)(I still prefer the old SQL Enterprise Manager..so much easier to use!) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-06 : 10:44:17
|
comes under your database->security->schemas in ssms------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
waveform
Yak Posting Veteran
93 Posts |
Posted - 2011-12-06 : 11:13:12
|
Ah, I see, thanks. The user is called "nhat1_user1", and is listed as owner of db_datareader and db_datawriter. I have just assigned it to db_owner as well, but still can't run the command.It's saying the "principal or schema 'nhat1_user1' does not exist in this database."The actual command I'm typing is:sp_changeobjectowner [dbo.id_job],nhat1_user1"id_Job" is the table I want to change ownership of, from "dbo" to the user. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
waveform
Yak Posting Veteran
93 Posts |
Posted - 2011-12-06 : 12:34:16
|
Thanks for reminding me. :p Nope, username is definitely "nhat1_user1".I gather you're saying it should work? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-06 : 12:50:25
|
quote: Originally posted by waveform Thanks for reminding me. :p Nope, username is definitely "nhat1_user1".I gather you're saying it should work?
it should work if such a schema exists but error messages suggests otherwise!------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
waveform
Yak Posting Veteran
93 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-07 : 00:56:45
|
sorry cant view images from here as its blocked I will take a look later in day from home and see------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
waveform
Yak Posting Veteran
93 Posts |
Posted - 2011-12-07 : 01:44:59
|
No worries. Thanks very much for your time. |
|
|
|