Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why view is still read-only?

Status
Not open for further replies.

edita

Programmer
Mar 26, 2003
14
PL
I created a view and added statement:

Grant all on nameofview to public

but this view is still read-only.
Have you got any sugestions how to change it?

Thanks in advance
 
Many views are read only because of the way the view was created.

Please post the view code.

Also lookup updatable view in books on line.
 
My code is like this:

IF EXIST... DROP VIEW

CREATE VIEW state_view
AS
SELECT my_primary_key, count
FROM dbo.name_table
WHERE count <> 0
GO

GRANT ALL ON state_view TO public
GO

As I read view like this can be updateable, but it's not. Where are mistakes?

Thanks

 
views with aggregate functions like count are not updateable
 
That view should be updatable. You might want to reconsider using the word count as a column name since it is a key word.

How are you trying to post to your view and exactly what error message are you getting back?
 
Sorry, I haven't got element named count, I've just change names like my_primary_key and count to make my question shorter but unfortunately I complicated it. So names cannot be a problem. I'm wondering if I have rights to set permissions like these, I'm the owner of database objects, but I'm not sysadmin and db_owner. Does it change anything in this situation?

Thanks for any sugestions

 
edita,
Please try and provide accurate information that people have asked for. Otherwise we can't tell what's actually going on.

a)What is the actual code for the view?
b)What is the exact error message you are getting? --James
 
Are you the owner of all the objects in the view? from Books Online:
&quot;If the ownership chain of a procedure or view is broken (not all the objects in the chain are owned by the same user), SQL Server checks permissions on each object in the chain whose next lower link is owned by a different user. In this way, SQL Server allows the owner of the original data to retain control over its accessibility.&quot;

Generally I find it to be a bad practice to have objects with any owner other than dbo in my database as it complicates permission setting and makes managing things harder as people come and go.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top