Default created with wrong name

powervisionpowervision Posts: 5
edited January 31, 2008 8:12AM in SQL Packager Previous Versions
Hi,

This problem apply's to Doc1 and Sql packager.
In the past i had an default value (sql 2005) named "NegOne". I deleted that default and created a new one. "NegativeOne". (This default is used in some custom data types). When i create a snapshot of the database a file is created with the name: NegativeOne. It contains this line (and some others): "create default [NegativeOne] as -1" So far so good.

When i create a exe with SQL Packager 5 the default is created with the old name (copy from script): "create default [NegOne] as -1". All other sql in the same scriptfile uses "NegativeOne" as default and the scripts fails to run (thats when i notist). I created html documentation with docman and this tool shows this:
Default - [dbo].[NegativeOne]
(local) > CSS_WH > Defaults > [dbo].[NegativeOne]
Quick Links
Properties SQL Script Uses Used By
Properties
Property Value
Owner dbo

SQL Script
SET QUOTED_IDENTIFIER OFF
GO
create default [NegOne] as -1

Uses

notice: Default - [dbo].[NegativeOne]<>create default [NegOne] as -1

i scaned my database compleetly, there is no "NegOne" default, reference or something with this name.

Question: where does "Doc1" en "Packager 5" gets the name used to create the scripts?

(i use all the latest version's of the software (toolbelt).

Regards,
Pepijn Visser

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello Pepijn,

    SQL Packager gets the name of objects by parsing the SQL code used to create the object in the case of UDFs, stored procedures, and defaults. When SQL Server is used to rename objects, typically it updates the sysobjects table and not the syscomments table, where the actual ddl is stored.

    For instance, running
    SELECT &#91;text&#93; FROM syscomments WHERE &#91;id&#93; IN &#40;SELECT id FROM sysobjects WHERE &#91;NAME&#93;='NegOne'&#41;
    
    More than likely, the result will show CREATE DEFAULT NeagtiveOne as... and that's the problem.

    The only way around I know of is to drop and recreate the default.
  • Hi,

    Thanx for the reply brian. I recreated the default and everyting works fine.

    regards,
    Pepijn Visser
Sign In or Register to comment.