Sql server 如何获取特定范围时间戳之间的值

Sql server 如何获取特定范围时间戳之间的值,sql-server,range,between,timestamp,datetime2,Sql Server,Range,Between,Timestamp,Datetime2,我在SQL Server 2008中有一个名为timestamlog的表,其中包含一列类型为INTEGER的名称LogTime` 值如下所示: 1350468610, 1350468000, 1350381600, 1350295810 我需要介于1350468609和1350468001之间的值 请告诉我如何查询这些值 我尝试了以下查询 select LogTime from timestamplog where LogTime between 1350468609 and 135046

我在SQL Server 2008中有一个名为timestamlog
的表,其中包含一列类型为
INTEGER的名称LogTime`

值如下所示:

1350468610,
1350468000,
1350381600,
1350295810
我需要介于
1350468609
1350468001
之间的值

请告诉我如何查询这些值

我尝试了以下查询

select LogTime 
from timestamplog 
where LogTime between 1350468609 and 1350468001

select LogTime 
from timestamplog 
where LogTime >= '1350468610' and  LogTime <= '1350468000'

select LogTime 
from timestamplog 
where LogTime >= convert(decimal, 1350468610) and LogTime <= convert(decimal,1350468000)

select LogTime 
from timestamplog 
where LogTime >= convert(varchar, 12) and LogTime <= convert(varchar, 14)
选择日志时间
从时间日志
其中,日志时间介于1350468609和1350468001之间
选择日志时间
从时间日志

其中LogTime>='1350468610'和LogTime=convert(decimal,1350468610)和LogTime=convert(varchar,12)和LogTime,因为1350468001小于1350468609,如果颠倒顺序,任何查询都可以工作。我会和

select LogTime from timestamplog where LogTime between 1350468001 and 1350468609

这是一个包含范围。

+1当然!:-)查询是正确的-但是
之间的值被翻转过来:-)捕捉得好!如果您可能没有该范围内的值,则上述查询不起作用。你的号码对吗?@user1716577“不工作”对任何人都没有帮助。它会产生错误吗?(如果是,错误是什么?)。它是否会产生错误的结果(如果是,如何产生错误?太多,太少,为什么应该/不应该包含某些结果?)导致您的机器爆炸?(不确定我们能帮上忙)那么就没有数据了。你能找到一个你认为应该显示的数字吗?