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 2000 Forums
 SQL Server Development (2000)
 Should I use a Column Formula?

Author  Topic 

kelleyb
Yak Posting Veteran

61 Posts

Posted - 2003-06-23 : 12:10:36
I need to ensure that the inserted values of a given column are a multiple of 256. I will use these values for bit-wise operations in my application. Is there a way to establish this limitation in a CREATE TABLE statement?

Thanks in advance

-Brian

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2003-06-23 : 12:13:39
Yes, you want a CHECK statement that ensures there is no remainder after dividing the column by 256, ie {column name} % 256 = 0.

Jonathan
{0}
Go to Top of Page

kelleyb
Yak Posting Veteran

61 Posts

Posted - 2003-06-23 : 12:27:44
Ahh Yes, Thanks Jonathan. I used (256 % testvalue = 0) to make sure it was a multiple.

As always, this site rocks! :)

-Brian



Edited by - kelleyb on 06/23/2003 12:30:26
Go to Top of Page
   

- Advertisement -