新手请教:SQLserver中有一datetime字段selldate不知用什么函数能取出他的时间,好象date(selldate)不行

ssd 2001-12-17 03:32:06
sql="select * from table1 where date(selldate)='"&searchdate&"'"好象不行
...全文
97 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lazywolf 2001-12-17
  • 打赏
  • 举报
回复
sql="select * from table1 where datediff(dd,selldate,'"&searchdate&"')=0"
free_doctor 2001-12-17
  • 打赏
  • 举报
回复
sql="select * from table1 where convert(datetime,selldate,120)=convert(datetime,'"&searchdate&"',120)"
ssd 2001-12-17
  • 打赏
  • 举报
回复
不行啊,他说120非法???
xmao 2001-12-17
  • 打赏
  • 举报
回复
用convert 函数
sql="select * from table1 where convert(varchar(20),selldate,120)='"&searchdate&"'"

28,404

社区成员

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

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