Re: Stored Procedure Security Problem



in SQL Server 2000, "schema_1" was created in T-SQL by running:
CREATE SCHEMA schema_1 AUTHORIZATION schema_1

This isn't valid SQL 2000 syntax, even though an error isn't raised. As you can see from the following SQL 2000 Books Online excerpt (http://msdn2.microsoft.com/en-us/library/aa258256(SQL.80).aspx), SQL 2000 syntax does not include schema name. The specified owner must be an existing user and, as far as I know, is only used to validate that the specified user exists:

CREATE SCHEMA AUTHORIZATION owner
[ < schema_element > [ ...n ] ]

< schema_element > ::=
{ table_definition | view_definition | grant_statement }

Despite the name, a CREATE SCHEMA statement in SQL 2000 doesn't create a schema in the SQL 2005 sense. It simply allows you to create multiple objects as part of an atomic statement without specifying objects in dependency order. You still need to owner-qualify objects and grant permissions as you would normally.

However user_1 does not seem able to run it. The error message mentions
"anonymous logon" however NT authorization is used and all other dbo.__
objects are selected and executed without a problem.

Strange that the error includes "anonymous logon". Can you post the full error message text? What does "SELECT USER" return when this user connects to the database using Windows authorization?

dbo can execute [schema_1].[SP_1] without any issues.

In SQL 2000, the database owner has full permissions over all objects in the database regardless of owner (schema). The object owner (same as schema name) has full control over all owned objects. All other uses need to be granted permissions either directly or via role membership.


--
Hope this helps.

Dan Guzman
SQL Server MVP

"Lolik" <Lolik@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:191FB4C9-F307-4082-BA16-20BDE96359E7@xxxxxxxxxxxxxxxx
I wonder if my problem is related to this same issue:

in SQL Server 2000, "schema_1" was created in T-SQL by running:
CREATE SCHEMA schema_1 AUTHORIZATION schema_1

then [schema_1].[SP_1] was created by dbo:
select *
into ##temp_table
from schema_1.view_1

user_1 who is not owner of schema_1 (and was not granted permission in
connection with schema_1) was given execute permission on schema_1.SP_1 using
Enterprise Manager.

However user_1 does not seem able to run it. The error message mentions
"anonymous logon" however NT authorization is used and all other dbo.__
objects are selected and executed without a problem.

dbo can execute [schema_1].[SP_1] without any issues.

Please help!

.



Relevant Pages

  • Re: Viewing object owner in SQL 2005 - ownership chaining
    ... preferred it if SQL 2005 supported EXECUTE AS for views). ... I'm beginning to understand that OWNER lives somewhere between the ... the owner of the schema the object was created it. ... In many databases, dbo owns everything. ...
    (microsoft.public.sqlserver.security)
  • Re: object cant be accessed unless owner is specified - SQL 2000
    ... The only reasonable explanation is that at this point Sune was the ... the qualfied query with the owner ... thus his default schema was dbo. ... SQL 2000 certainly has schemas! ...
    (microsoft.public.sqlserver.security)
  • Re: Access 2007, SQL 2000
    ... Since users are not dbo, and SQL 2000 used the user name as the schema identifier, you have to make sure that every reference to a SQL Server object is fully qualified with the dbo. ... Normally a user should not be able to create any new objects in the db, but if they do, those new objects will be in the userName schema, not the dbo schema, assuming the user is not a db owner. ...
    (microsoft.public.access.adp.sqlserver)
  • SQL Adapter Disassembling Result Sets & Dynamic Parameters
    ... properties of the schema returned in my orchestration. ... Also after processing all the records returned by SQL adapter in my ... from the toolbox drag an xml disassembler ...
    (microsoft.public.biztalk.general)
  • SQL Adapter Disassembling Result Sets & Dynamic Parameters
    ... properties of the schema returned in my orchestration. ... Also after processing all the records returned by SQL adapter in my ... from the toolbox drag an xml disassembler ...
    (microsoft.public.biztalk.server)