Forums

This topic is locked

SQL Stored Prodcedure

Posted 19 Feb 2004 16:40:07
1
has voted
19 Feb 2004 16:40:07 Stephen Cairns posted:
I am converting a Query in Access over to a stored procedure and I am having some problems with my functions. The CDate doesn't seem to be a recognised name, and it doesn't seem to like syntax near 'dbo.cms_out.date'.
The select part of the statement which is giving me trouble is below. Can anyone advise me on how to solve these problems: -

SELECT
CDate('2003/02/08') AS FromDate,
CDate('2003/02/15') AS ToDate,
dbo.cms_out.date,
CInt(Left(Format((([dbo.cms_out.date]- CDate('2003/02/08')/7),"00.0",2)) AS HEREExpr2,
DateAdd("d",(7*(CInt(Left(Format((([dbo.cms_out.date]-CDate('2003/02/08')/7),"00.0",2)))),'2003/02/15') AS TestDate

The dates e.g. '2003/02/08' are parameters which il eventually need to add in.

Original MS Access query: -
SELECT dbo_cms_out.t_row_type, dbo_cms_out.account_no, dbo_cms_out.agent_name, dbo_cms_out.publication_name, dbo_cms_out.edition_name, dbo_cms_out.t_quantity, dbo_cms_out.t_allowance, dbo_cms_out.calculated_price, dbo_cms_out.day_of_week, dbo_Classifications.Description, CDate([forms]![satfri]![Lbltest].caption) AS Fromdate, CDate([forms]![satfri]![txtTo].value) AS todate, dbo_cms_out.date, CInt(Left(Format((([dbo_cms_out].[date]-CDate([forms]![satfri].[lbltest].caption))/7),"00.0",2)) AS HEREExpr2, DateAdd("d",(7*(CInt(Left(Format((([dbo_cms_out].[date]-CDate([forms]![satfri].[lbltest].caption))/7),"00.0",2)))),[forms]![satfri]![txtfirst].value) AS test

Reply to this topic