sql语句查询时间问题?

xieqi 2003-08-05 10:39:41
我拥的sql server数据库。time1的属性为datetime,关于时间查询怎么用?

我用sql="select * from table where time1="+now()
这样好象不行的。

time1=now()
sql="select * from table where time1='"+time1+"'"
也不行


...全文
45 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
summercat 2003-08-05
  • 打赏
  • 举报
回复
sql="select * from table where time1='2004-7-5'"

sql="select * from table where time1='"&now()&"'"
xieqi 2003-08-05
  • 打赏
  • 举报
回复
不行啊
sql="select * from table where time1=+"&2004-7-5 11:23:23&"+"
不行的
wwweather 2003-08-05
  • 打赏
  • 举报
回复
sql="select * from table where time1=+"&time1&"+"
QQgenie 2003-08-05
  • 打赏
  • 举报
回复
上行多了一个"'" ^=^
sql="select * from table where to_char(time1,'yyyy-mm-dd')='2004-7-5'"
QQgenie 2003-08-05
  • 打赏
  • 举报
回复
用sql="select * from table where to_char(time1,'yyyy-mm-dd')=''2004-7-5'"试试,ORACLE下应用正常.

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧