![]() |
|
|
+ Search |
![]()
|
Jul 21st, 2000 22:16
unknown unknown, Bruce Anwyl
You can use bit but if you search long enough through SQL Server
documentation you will find that the bit type is not recommended for
this any more. Instead use a char(1) field with the value 'Y' for true
and 'N' for false and put a constraint on the table to restrict the
values.
CREATE TABLE [dbo].[AdditionalCharge] (
[AdditionalChargeID] [int] IDENTITY (1, 1) NOT NULL ,
[DateCharged] [smalldatetime] NOT NULL ,
[CustomerID] [int] NOT NULL ,
[Invoiced] [char] (1) NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AdditionalCharge] WITH NOCHECK ADD
CONSTRAINT [DF_AdditionalCharge_Invoiced] DEFAULT ('N') FOR [Invoiced] ,
CONSTRAINT [CK_AdditionalCharge_Invoiced] CHECK ([Invoiced] = 'N' or
[Invoiced] = 'Y')
GO
© 1999-2004 Synop Pty Ltd