Options

Error on Renaming Company on SQL Server database

rashidkhanrashidkhan Member Posts: 4
Dear All,

I am getting the following error while trying to rename the company on a SQL Server database from Nav 2009 Sp1 Client.Kindly help.

Microsoft Dynamics NAV Classic
The following SQL Server error or errors occurred when accessing the Trans. Sales Entry table:

15336,"42000",[Microsoft][ODBC SQL Server Driver][SQL Server]Object '"TESTDB"."dbo"."XYZ$Trans_ Sales Entry"' cannot be renamed because the object participates in enforced dependencies.

SQL:
{CALL [sp_rename](?, ?, ?)}

Comments

  • Options
    ChinmoyChinmoy Member Posts: 359
    One thought that crosses my mind is that you might have checked the 'Maintain Relationships' for your database. This will create foreign keys in SQL Server. You can give it a try after unchecking this.

  • Options
    bbrownbbrown Member Posts: 3,268
    AFAIK the releations set by "Maintain Relations" are not enforced. So I'm thinking that is not the issue. I'd suspect a change directly in SQL. But I could be wrong.

    Go to SSMS and run "View Dependencies" on that table.
    There are no bugs - only undocumented features.
  • Options
    rashidkhanrashidkhan Member Posts: 4
    Thanx Chinmoy for the reply.
    But there is no tick on Maintain Relationships.
  • Options
    KishormKishorm Member Posts: 921
    Check in SQL Server Studio Manager to see if you have any SQL indexes created on the table outside of NAV - I.e. Not in the usual NAV structure of companyname$tablename$number - if so then try deleting it/them then renaming the company and then recreating if required.
  • Options
    ChinmoyChinmoy Member Posts: 359
    rashidkhan wrote:
    Thanx Chinmoy for the reply.
    But there is no tick on Maintain Relationships.

    I suggest that you "View Dependencies" on the table from SQL Server Management Studio. If there are any which is out of NAV (i.e. created from SQL, then delete them and retry.
  • Options
    rashidkhanrashidkhan Member Posts: 4
    @ Chinmoy and Kishorm,
    Thanks a lot for the help.

    I deleted all the views of the Trans. Sales Entry table in SSMS. After that I was able to rename the company and then I compiled and redesigned the table in NAV.
  • Options
    rsaritzkyrsaritzky Member Posts: 469
    This is true of any views in the database that are created. You have to DROP the views (and delete the linked tables if they exist), rename the company, then recreate the views.
    Ron
Sign In or Register to comment.