SQL 2005 and Auto Increment

rrvanzylrrvanzyl Member Posts: 21
edited 2007-10-17 in SQL General
I have just come across a very ineresting "feature". When using the Auto Increment property on a Interger field in a table, and running on a SQL 2005 installation, a user without sys-admin rights gets a very vicious SQL error stating that the user doesn't have permission (even if it was setup and synched with SQL) or the table doesn't exist. This doesn't happen when the user capture data directly on the table, only if you use a indirect method through code or a dataport to insert/modify data in that table. Has anyone else come across this? Is there any way in SQL Server where you have to set a certain setting to cater for this propoerty?

Thanks!

R

Comments

  • ara3nara3n Member Posts: 9,256
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kinekine Member Posts: 12,562
    1) When you are using Autoincrement, you need to CLEAR the field to 0 before you will insert it into DB. Else this error is called
    2) Why? Because if you try to force the value of the Autoincrement field, SQL needs to set the autoincrementing caunter to new value but this can be done just with db_owner privileges. It means, there is error in your code (do not forget, that INIT is not clearing PK fields!).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,115
    [Topic moved from Navision forum to SQL General forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.