Select * from 表 where Time between time1 and time2orSelect * from 表 where Time>=time1 and Time<=time2
解决方案 »
- 有谁知道用友南京公司的薪酬情况的???请大家进来坐坐。。
- 在后台数据库中将已经有的数据字段补足10位 ,急着解决
- 如何按日期为某一字段赋值?
- 在SQL Server 中备份数据库的sql语句 及 还原数据库的SQL语句是什么?
- 数据库问题
- 我用odbc数据源和查询分析器都能连接远程服务器,可是用企业管理器"新建注册"在连接时提示:"超时已过期",这怎么办?
- 请问sql server 6.5为何不能在win2000下安装呀!
- 高手帮忙写一个复杂的Update 语句!
- SQL SERVER2000数据库恢复问题
- 怎樣在查詢分析器裏面寫測試腳本?測試某個存儲過程的output參數?
- 关于出现从重复字段
- 小弟定义了一个存储过程,参数的类型为varchar(100),调用的时候如果参数是字符型的就出错!!!
select * from yourtable where [time]>=@time1 and [time]<=@time2
select * from Tab where right(convert(varchar(20),time,120),8)
between right(convert(varchar(20),time1,120),8)
and right(convert(varchar(20),time2,120),8)
Select * from 表 where 时间列 between '1999-1-1' and '1999-1-31'
Select * from 表 where 时间列 between '1999-1-1 10:10:10' and '1999-1-31 10:10:10'
CREATE FUNCTION [dbo].[UF_DatetimeToInt] (@dtDateTime datetime)
RETURNS int
AS--*****--
BEGIN
declare @iDateInt int set @iDateInt = year(@dtDateTime)*10000 + month(@dtDateTime)*100 + day(@dtDateTime)
return @iDateInt
END
2。写SQL语句
select * from tab
where dbo.UF_DatetimeToInt(time) > dbo.UF_DatetimeToInt(time1)
and dbo.UF_DatetimeToInt(time) < dbo.UF_DatetimeToInt(time2)