Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Table Owner

Author  Topic 

danasegarane76
Posting Yak Master

242 Posts

Posted - 2007-04-04 : 09:08:25
Dear All,
How can I change the owner of the table

Dana

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-04 : 09:10:54
Read about sp_changeobjectowner in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-04 : 09:11:27
sp_changeowner

or is it

sp_changeobjectowner

??? Can't remember.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

danasegarane76
Posting Yak Master

242 Posts

Posted - 2007-04-04 : 09:15:31
Dear Madhi,
I tried like this

Exec sp_changeobjectowner 'danauser.macro_path','dbo'

But I am getting the error as

Object 'danauser.macro_path' does not exist or is not a valid object for this operation.

But I can sure that the Table exist with the name
danauser.Macro_Path

What could be the problem
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-04 : 09:17:29
Maybe you have no permissions to change the owner?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-04 : 09:18:05
quote:
Originally posted by Peso

sp_changeowner

or is it

sp_changeobjectowner

??? Can't remember.


Peter Larsson
Helsingborg, Sweden



Are you kidding, Peter? Or you are trying to force OP to read about it in BOL?

Dana,

You need to make sure specified owner name and table name really exists. Try this:

select * from information_schema.tables where table_schema = 'danauser' and table_name = 'macro_path'




Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

danasegarane76
Posting Yak Master

242 Posts

Posted - 2007-04-04 : 09:18:22
The table and database is located in my machine :)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-04 : 09:18:36
Try

Exec sp_changeobjectowner macro_path','dbo'


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2007-04-04 : 09:18:46
Out of interest is this one of the new features of 2005
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-04 : 09:19:54
quote:
Originally posted by madhivanan

Try

Exec sp_changeobjectowner 'macro_path','dbo'


Madhivanan

Failing to plan is Planning to fail



Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-04 : 09:20:25
quote:
Originally posted by NeilG

Out of interest is this one of the new features of 2005



No. It was present in SQL2K as well.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

danasegarane76
Posting Yak Master

242 Posts

Posted - 2007-04-04 : 09:21:14
Dear harsh,
I am getting this output after executing this query

Thomson danauser Macro_Path BASE TABLE

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-04 : 09:21:48
quote:
Originally posted by Peso

sp_changeowner

or is it

sp_changeobjectowner

??? Can't remember.


Peter Larsson
Helsingborg, Sweden


Effect of too much of work

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-04 : 09:22:24
quote:
Originally posted by harsh_athalye

Are you kidding, Peter? Or you are trying to force OP to read about it in BOL?

People seem to be upset when I ask them to read Books Online.
It's better when I write I don't remember, then they will read Books Online without hesitation!

Mission accomplished anyway


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-04-04 : 09:26:07
<<
It's better when I write I don't remember, then they will read Books Online without hesitation!
>>

New technique. Not bad

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-04 : 09:28:51
quote:
Originally posted by Peso

quote:
Originally posted by harsh_athalye

Are you kidding, Peter? Or you are trying to force OP to read about it in BOL?

People seem to be upset when I ask them to read Books Online.
It's better when I write I don't remember, then they will read Books Online without hesitation!

Mission accomplished anyway


Peter Larsson
Helsingborg, Sweden



Innovative technique to compel people to do what we want without hurting them !!

I need to keep this in mind

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

danasegarane76
Posting Yak Master

242 Posts

Posted - 2007-04-04 : 09:37:47
Dear Peter and Harsh,

How can I solve my Problem.

Dear Peter :)
You can directly tell me to read the BOK No Probs.I am still a learner.


Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-04 : 09:41:08
Did you try Madhis
Exec sp_changeobjectowner 'macro_path', 'dbo' without previous owner

Only member of db_owner (or having both db_ddladmin and db_securityadmin), can change owner on the object.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

danasegarane76
Posting Yak Master

242 Posts

Posted - 2007-04-04 : 09:44:07
Dear Peter,
I get this message
Object ' macro_path' does not exist or is not a valid object for this operation.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-04-04 : 09:48:09
Which role do you currently have? See my previous post.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

danasegarane76
Posting Yak Master

242 Posts

Posted - 2007-04-04 : 09:59:55
My role is Db_Owner.Sorry if i am wrongly replied
Go to Top of Page
    Next Page

- Advertisement -