Results 1 to 8 of 8

Thread: Some way around this?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Some way around this?

    I have a stored procedure that is called by users with DataReader and DataWriter rights. This stored procedure is used in the monthly closing for this company. It removes all of the records from the PaidOuts table and then needs to reset the Identity Seed to 0.

    When we went live I used:

    Code:
    DBCC CHECKIDENT ('PaidOuts', RESEED , 0)
    However, that gave an error stating that the user did not have enough permissions on the table.

    I then changed the code to:

    Code:
    TRUNCATE TABLE PaidOuts
    This, too, gave me the same message. What permissions would be needed to execute one of these statements?

    Is there any way to have a DataReader/DataWriter user reset the Identity seed for a table?
    My.Settings.Signature = String.Empty

  2. #2
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Some way around this?

    run them as sa
    "The dark side clouds everything. Impossible to see the future is."

  3. #3
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Some way around this?

    sa is sql authentication - you should not even be using sql authentication...

    At any rate - what PERMISSIONS have you GRANTED to the SPROC that does this?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Re: Some way around this?

    I have granted Domain Users (this is a very small office) DataReader and DataWriter rights to the applications. And that group has Execute permissions on the SP.
    My.Settings.Signature = String.Empty

  5. #5
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Some way around this?

    Books Online shows the permissions needed for CheckIdent

    Permissions
    DBCC CHECKIDENT permissions default to the table owner, members of the sysadmin fixed server role, and the db_owner and db_ddladmin fixed database role, and are not transferable.
    Seems to be the same for TRUNCATE - interesting...

    Permissions
    TRUNCATE TABLE permissions default to the table owner, members of the sysadmin fixed server role, and the db_owner and db_ddladmin fixed database roles, and are not transferable.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Re: Some way around this?

    Any other thoughts on resetting the Identity for this table? This is a table that holds information about Petty Cash pay outs. There really aren't that many during each month. They just like to see the reference number incremented starting at 1.

    I could create another column in the table that is just a Count() + 1.
    My.Settings.Signature = String.Empty

  7. #7
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Some way around this?

    Are you against giving one of those permissions to the users who might run this option? Like the DB_DDLADMIN role?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Re: Some way around this?

    Well... I currently just use the Domain Users account. I could just assign Domain Users to the DB_DDLADMIN role. I don't see much harm in that.
    My.Settings.Signature = String.Empty

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width