Changing Ownership - Granting SELECT perms in SQL 2005

03/03/09

Permalink 08:13:50 am, by dave Email , 122 words, 2241 views   English (US)
Categories: Microsoft Tools, Using the Built-In Tools

Changing Ownership - Granting SELECT perms in SQL 2005

I had an interesting issue today. I was working with a product that needed select privileges to the sys tables and have ownership of the table it was going to use on a SQL 2005 Server. After trying various combination of permission settings. I came across the following two commands that did the trick for me.

Grant SELECT privileges to tables:

SELECT 'GRANT SELECT ON ' + TABLE_NAME + ' TO [user]' FROM INFORMATION_SCHEMA.Tables;

Change table ownership:

ALTER AUTHORIZATION ON [database].[table] TO [user];

Everything inside the [ ] are the portions that I had to change for my specific set up.

So if you ever need to grant select privileges tables or grant ownership to a table in SQL 2005, I hope this helps out.
Dave



Did you like this post? If so, Share it!  del.icio.us digg reddit slashdot this article Facebook Twitter MySpace Email



Pingbacks:

No Pingbacks for this post yet...

This post has 1 feedback awaiting moderation...

Windows Tools & Utilities

A place to share interesting and cool windows related tools, utilities, and applications that might be helpful to folks.

Search

Follow Me:

Misc

Who's Online?

  • Guest Users: 2

powered by b2evolution free blog software