本文介绍了我想以正确的方式编写此查询吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT * 
FROM 
    tblPickupDetails 
WHERE 
    (Recivedtime 
     BETWEEN 
         '" + FromDate + "00:00:00.000" + "'  AND '" + Todate + "23:59:59.999"+ "')


我需要以正确的方式编写此查询吗?

我认为以下陈述是错误的.


I need to write this query in correct way ?

I think following statement is wrong.

(Recivedtime 
 BETWEEN 
     '" + FromDate + "00:00:00.000" + "'  AND '" + Todate + "23:59:59.999"+ "')

推荐答案

SELECT * 
FROM tblPickupDetails 
WHERE 
CONVERT(VARCHAR(10) ,Recivedtime ,101) >= CONVERT(VARCHAR(10) ,@FromDate,101)
CONVERT(VARCHAR(10) ,Recivedtime ,101) <= CONVERT(VARCHAR(10) ,@ToDate,101)



-Milind



-Milind


这篇关于我想以正确的方式编写此查询吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 18:52