SQL Error when importing objects

wash64864wash64864 Member Posts: 13
edited 2008-08-14 in SQL General
I am trying to import objects into Navision SQL. Some of the columns in the table are being deleted. All the data in the columns are blank or zero, but I get and error message which reads as follows: The statistics (column name) is dependent on (column name). ALTER TABLE DROP COLUMN (column name) failed because one or more objects access the column. I tried dropping statistics on the table but to no avail. Has anyone encountered this problem?

Comments

  • krikikriki Member, Moderator Posts: 9,112
    I think you have in File=>Database=>Alter=> Tab Integration=>Field "Maintain Relationships"=Yes.
    Removing this toggle might help. But I don't know what the consequences are of removing the toggle. I never removed it, because when I create a DB, I don't put it to Yes.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • WaldoWaldo Member Posts: 3,412
    Did you try to deselect the "auto update statistics" in the enterprise manager (or management studio in case of SQL2005)?

    Try to update statistics overnight (INDEXONLY).

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • AdministratorAdministrator Member, Moderator, Administrator Posts: 2,500
    [Topic moved from Navision to SQL General forum]
  • bbrownbbrown Member Posts: 3,268
    Was this issue ever resolved? I'm running into this same problem on a current upgrade. Maintain Relations is NO. And Auto Update Stats is off.
    There are no bugs - only undocumented features.
  • BlackcatBlackcat Member Posts: 28
    Hi,
    I have the same Problem,
    could someone please tell me how i could solve this ??
    [-o<
  • bbrownbbrown Member Posts: 3,268
    I was able to resolve this issue by dropping the statistics before importing the objects. Then just do a create statistics after.

    I put together the following SQL script for the drop.

    DECLARE @SQLString nvarchar(500);
    DECLARE Stat_Cursor CURSOR
    FOR
    Select OBJECT_NAME(object_id), name from sys.stats
    Where user_created = 1;
    OPEN Stat_Cursor;
    DECLARE @ObjectName sysname;
    DECLARE @StatName sysname;
    FETCH NEXT FROM Stat_Cursor
    INTO @ObjectName, @StatName;
    @FETCH_STATUS = 0
    BEGIN
    SET @SQLString = '';
    SET @SQLString = 'DROP Statistics [';
    SET @SQLString = @SQLString + @ObjectName;
    SET @SQLString = @SQLString + '].[';
    SET @SQLString = @SQLString + @StatName;
    SET @SQLString = @SQLString + ']';
    EXECUTE sp_executesql @SQLString;
    FETCH NEXT FROM Stat_Cursor
    INTO @ObjectName, @StatName;
    END;
    CLOSE Stat_Cursor
    DEALLOCATE Stat_Cursor
    GO
    There are no bugs - only undocumented features.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I think Joerg describes this problem in his blogpost but it is very technical.

    http://dynamicsuser.net/blogs/stryk/arc ... stics.aspx

    These functions also exists in our SQL perform tools but those are not available for free I'm affraid as they also contain much much more functionality.

    Good luck
Sign In or Register to comment.