- see footer for list info -<
You have to do it differently, I don't believe you can break a SQL statement with IFs.

If EventTypeID is passed to the SP as @EventTypeID (or not passed), you could default the @EventTypeID to 0:

@EventTypeID int = 0

And then the last expression might be:

AND ( isnumeric(@EventTypeID) AND @EventTypeID > 0 AND @EventTypeID = EventTypeIDFK )

or

AND (@EventTypeID = EventTypeIDFK OR NOT isnumeric(@EventTypeID) OR @EventTypeID = 0)


dominic

Paul Swingewood wrote:

- see footer for list info -<

How can I put <cfif> in a stored procedure?

WHERE EventTypeIDFK = EventTypeIDPK
AND (StartDateTime BETWEEN #StartDate# AND #EndDateTime#
OR EndDateTime BETWEEN #StartDate# AND #EndDateTime#
OR #StartDate# BETWEEN StartDateTime AND EndDateTime)
<cfif IsDefined("URL.EventTypeID") AND IsNumeric(URL.EventTypeID)>
AND EventTypeIDFK = #URL.EventTypeID#
</cfif>
ORDER BY StartDateTime

Regards - Paul


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-

- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<



_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
- Hosting provided by www.cfmxhosting.co.uk -<
- Forum provided by www.fusetalk.com -<
- DHTML Menus provided by www.APYCOM.com -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to