Wrong default value

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jmuehlenhoff
Posts: 36
Joined: Fri 30 Apr 2010 11:25

Wrong default value

Post by jmuehlenhoff » Thu 27 Jun 2013 13:20

Hi,

I've got two tables:

Code: Select all

CREATE TABLE [dbo].[Script] (
    [Script_ID] UNIQUEIDENTIFIER CONSTRAINT [DEF_Script_Script_ID] DEFAULT newid() NOT NULL,
    [Name] NVARCHAR(50) COLLATE Latin1_General_CI_AS NOT NULL,
    [OrderTag] INTEGER,
    [DBAGuid] UNIQUEIDENTIFIER,
    [SQL] NVARCHAR(max) COLLATE Latin1_General_CI_AS NOT NULL,
    [ScriptCondition_ID] UNIQUEIDENTIFIER,
    [ScriptOrder_ID] UNIQUEIDENTIFIER,
    [Predefined] BIT CONSTRAINT [DEF_Script_Predefined] DEFAULT 0 NOT NULL,
    [ArchiveMode] INTEGER CONSTRAINT [DEF_Script_ArchiveMode] DEFAULT 0 NOT NULL,
    CONSTRAINT [PK_Script_dbo] PRIMARY KEY NONCLUSTERED ([Script_ID])
)
GO

CREATE UNIQUE NONCLUSTERED INDEX [IDX_Script_1] ON [dbo].[Script] ([Predefined] ASC,[Name] ASC)
GO

CREATE TABLE [mgmt].[Script] (
    [Script_ID] UNIQUEIDENTIFIER NOT NULL,
    [Name] NVARCHAR(50) COLLATE Latin1_General_CI_AS NOT NULL,
    [OrderTag] INTEGER,
    [DBAGuid] UNIQUEIDENTIFIER,
    [SQL] NVARCHAR(max) COLLATE Latin1_General_CI_AS NOT NULL,
    [ScriptCondition_ID] UNIQUEIDENTIFIER,
    [ScriptOrder_ID] UNIQUEIDENTIFIER,
    [Predefined] BIT CONSTRAINT [DEF_Script_Predefined] DEFAULT 1 NOT NULL,
    [ArchiveMode] INTEGER CONSTRAINT [DEF_Script_ArchiveMode] DEFAULT 0 NOT NULL,
    CONSTRAINT [PK_Script_mgmt] PRIMARY KEY NONCLUSTERED ([Script_ID])
)
GO

CREATE UNIQUE NONCLUSTERED INDEX [IDX_Script_1_mgmt] ON [mgmt].[Script] ([Predefined] ASC,[Name] ASC)
GO
I created a TMSTable with 'Script' as the TableName and Options.DefaultValues set to True.

When I call Table.Insert the field 'Predefined' is set to 'True', but the table 'dbo.Script' has the default value '0' for this field.

Is this a bug in the table component?

I'm using version 6.6.12.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Wrong default value

Post by AlexP » Mon 01 Jul 2013 14:02

Hello,

Thank you for the information. We have reproduced the problem and will fix it as soon as possible. For the time being, to solve the problem, you should explicitly specify the schema name before the table name.

AndreyZ

Re: Wrong default value

Post by AndreyZ » Thu 11 Jul 2013 06:55

Thank you for the information. We have fixed this problem. This fix will be included in the next SDAC build.

Post Reply