Subject Re: [IB-Conversions] MS create default => IB domain.
Author Helen Borrie (Team JEDI)
At 09:08 PM 13-09-00 -0400, you wrote:


> Hello, any suggestion on how to tame MsSql issues like this to
> make an
>equivalent or mimic behavior on IB?
>
>CREATE DEFAULT dbo.UW_ZeroDefault AS 0
>go
>IF OBJECT_ID('dbo.UW_ZeroDefault') IS NOT NULL
> PRINT '<<< CREATED DEFAULT dbo.UW_ZeroDefault >>>'
>ELSE
> PRINT '<<< FAILED CREATING DEFAULT dbo.UW_ZeroDefault >>>'
>go
>
> The only thing is a domain, but an IB's domain is like an MsSql's
> User
>Datatype. In this case, MsSql's defaults are only values. I read in the
>online books:

>Defaults, a backward compatibility feature, perform some of the same
>functions as default definitions created using the DEFAULT keyword of ALTER
>or CREATE TABLE statements.

> So probably a default alone should be deprecated in favor of what
> MS calls
>"default definitions" that are no more than the DEFAULT keyword inside a
>CREATE TABLE command. In this regard, IB's domains provide both
>functionalities: they are reusable across table definitions and they are
>defined only one. This is the reason I think both User Defined Datatypes and
>Default alones (made by CREATE DEFAULT) in MsSql should be mapped to IB
>domains.

Not exactly. It is possible to define a default and a check constraint for
an IB domain. That is not possible for a MSSQL User-defined datatype.

The stand-alone defaults (from CREATE DEFAULT) were deprecated in favour of
the ANSI SQL standard of including them in the DDL of the table as long ago
as 1995 (v. 6.0).

Just another note - in MSSQL it is possible to define conditional defaults
in the CREATE TABLE statement, using a CASE predicate. This would be
problemmatical in IB - I believe the defaulting in this case would have to
be done at table level, using triggers, because IB doesn't let you have
conditional defaults in either domains or triggers.

> I will reiterate that MS considers defaults alone to be a backwards
>compatibility (legacy) feature and they write about using default on every
>field at table definition time, but they fail to tell that this can be done
>by a Domain... well, User Defined Datatype for the non-ANSI MsSql.
>
>Comments?

That's because It can't be done by a UDDT.

Helen
All for Open and Open for All
InterBase Developer Initiative · http://www.interbase2000.org
___________________________________________________
Project JEDI · http://delphi-jedi.org
___________________________________________________