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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 how to avoid zero value

Author  Topic 

teamjai
Yak Posting Veteran

52 Posts

Posted - 2012-01-04 : 05:56:31
hello

i do not allow zero.. how can i do this.

example:
Table1
Column
Number-------name
1------------aa
2------------bb
0------------cc
number are entered manually..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-04 : 06:04:47
put a check constraint on Number column like

ALTER TABLE ADD CONSTRAINT Chk_NumberNonZero CHECK (Number > 0)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -