syntax error in the SQL script

LexDeveloperLexDeveloper Posts: 3
edited August 18, 2006 12:36PM in SQL Compare Previous Versions
The SQL script generated by SQL Compare 5 version 5.2.0.32 contained a syntax error that caused the sync to fail.

The unlicensed trial version generated this block with an extra ']':

PRINT N'Dropping constraints from [dbo].[field_reporter_text]'
GO
ALTER TABLE [dbo].[field_reporter_text] DROP CONSTRAINT [DF_field_reporter_text_frt_lang_code
frt_lang_code]]
GO
IF @@ERROR<>0 AND @@TRANCOUNT>0 ROLLBACK TRANSACTION
GO
IF @@TRANCOUNT=0 BEGIN INSERT INTO #tmpErrors (Error) SELECT 1 BEGIN TRANSACTION END
GO

Let me know if additional information is required.

Comments

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

    That's interesting... what name do you get back when you run
    select name from sysobjects where name like 'DF_field_reporter_text_frt_lang_code 
    frt_lang_%' AND xtype='F'
    
  • Nothing came back from
    select name from sysobjects where name like 'DF_field_reporter_text_frt_lang_code 
    frt_lang_%' AND xtype='F'
    

    but that made me dig deeper into our database, and that is where the problem was. :oops:


    When we generated the script for the destination table, we got
    CREATE TABLE [*****].[field_reporter_text]
    (
    [frt_fr_text_id] [int] NOT NULL IDENTITY(1, 1),
    [frc_category_id] [int] NULL,
    [frt_form_text] [text] NOT NULL,
    [frt_language] [varchar] (10) NULL,
    [frt_lang_code] [int] NOT NULL CONSTRAINT [DF_field_reporter_text_frt_lang_code
    frt_lang_code]] DEFAULT (17),
    [frt_effective_date] [datetime] NOT NULL,
    [frt_inactive_date] [datetime] NULL
    )
    
    GO
    
    showing the contraint definition was bad.

    Somehow, the contraint was not showing in the diagrams, or design wizards in Enterprise Manager. :shock: SQL Compare generated the script as it should have. :D After the correction to our table was made, SQL Compare worked fine, and saved us a great deal of time.

    Thank you for the assistance.
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi,

    I figured that SQL Compare must have been picking up that extra bracket from somewhere. I'm glad that you've figured it out!
This discussion has been closed.