Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date problem

Status
Not open for further replies.

siraj777

Programmer
Aug 22, 2002
27
IN
I am running PB 6.5 under Sql Server 6.5 (connected THRU ODBC), I have dw with the following SQL

SELECT cctr_master,
(case when starttime < shift_starttime then
dateadd(d,-1, startdate) else
startdate end) from st
where (case when starttime < shift_starttime then
dateadd(d,-1, startdate) else
startdate end) = :start_date

I am getting following error when I preview the dw, if I hardcode the value for ex:'08/22/2002', no error is displayed. Please help.

Select Error: SQLSTATE = 37000
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ','.

Thanks.
 
you must replace &quot;d&quot; by &quot;dd&quot; or &quot;day&quot;, i.e:
SELECT cctr_master,
(case when starttime < shift_starttime then
dateadd(dd,-1, startdate) else
startdate end) from st
where (case when starttime < shift_starttime then
dateadd(dd,-1, startdate) else
startdate end) = :start_date

Then it will work!

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top