Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这是我的简化表(SQL Server 2005):
table1: col1 int, col2 int, col3 cast(col1/col2 as int) [computed column]
由于某种原因,上述方法不起作用。我只想保存 col1/col2 的整个部分,我该怎么做?
example: col1 = 5, col2 = 3 ... col3 should be 1
一种选择是使用floor 函数:
地板(col1/col2)
或者
CONVERT(int, FLOOR(col1/col2)) -- 可能是矫枉过正