t-SQL中的最大int值

时间:2011-09-20 03:32:10

标签: sql-server tsql int max

我想用列值验证int的Max值是否可能?
例如: - select * from table_name where column_name= Max(int)

2 个答案:

答案 0 :(得分:2)

select * from table_name where column_name=0x7fffffff

答案 1 :(得分:1)

我假设您想要具有最高值的行,而不是实际的2 ^ 31-1值

SELECT TOP 1 *
FROM table_name
ORDER BY column_name DESC

如果你有多个最高值,那么

SELECT TOP 1 * WITH TIES
FROM table_name
ORDER BY column_name DESC

如果您希望每个论坛或其他专栏获得最高分,请告诉我们:can be done too.