Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to declare postive values

Author  Topic 

Mohamed Faisal
Yak Posting Veteran

51 Posts

Posted - 2012-09-23 : 12:32:51
Hi All,

CREATE TABLE ServiceTable
(
referenceNum int NOT NULL IDENTITY(100000,1),
serviceDate DATETIME NOT NULL,
serviceCode Char(3) NOT NULL,
actualService MONEY NOT NULL ,
CONSTRAINT ServiceRenderedTablePK PRIMARY KEY(referenceNum,serviceDate),
CONSTRAINT CaseTableFK FOREIGN KEY(referenceNum)
REFERENCES CaseTable(referenceNum),
CONSTRAINT ServiceTableFK FOREIGN KEY(serviceCode)
REFERENCES ServiceTable(serviceCode)
);

how to declare positive money values to the column of actualService

bitsmed
Aged Yak Warrior

545 Posts

Posted - 2012-09-23 : 16:06:21
add this to your constraint list:
CONSTRAINT actualService_positive CHECK (actualService>0.00)
Go to Top of Page

Mohamed Faisal
Yak Posting Veteran

51 Posts

Posted - 2012-09-24 : 03:36:40
Dear bitsmed,

Thanks Allot.
Go to Top of Page
   

- Advertisement -