0
我需要能夠顯示當天搜索參數顯示的信息。我想這個查詢將削減芥末,但是它提出的顯示同一天的SQL數據
Msg 241, Level 16, State 1, Line 13
錯誤從字符串轉換日期和/或時間時,轉換失敗。
這是我的語法,我該怎麼做才能刪除錯誤?
DECLARE
@startDate datetime,
@endDate datetime
SET @startDate = '06/11/2015'
SET @endDate = '06/11/2015'
Set @startDate = convert(varchar(100),@startDate, 101) + ' 00:00:00 AM'
Set @endDate = convert(varchar(100),@endDate, 101) + ' 23:59:59 PM'
select 'Artay' As [Bank Name]
,COUNT(Transaction) As LC
from dbo.financialtransactions
where cleardate between ''' + @startDate + ''' and ''' + @endDate + '''