【发布时间】:2014-07-10 17:09:44
【问题描述】:
我想对下表中的值设置一些特殊限制:
CREATE TABLE MyTable
{
id varchar(100) NOT NULL PRIMARY KEY,
first_special varchar(8), <- I want it to have max of 8 symbols with no spaces in it
second_special float <- I want it to have precision of 2 decimal points after the '.'
}
编辑:
平台是 Microsoft SQL Server。
【问题讨论】:
-
不要使用
float(或double或类似的东西)。这些近似类型和您存储的内容不一定与您稍后检索的相同。使用numeric或number或 DBMS 中的任何名称。
标签: sql sql-server ddl