Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8549483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:43:28+00:00 2026-06-11T13:43:28+00:00

I have a Sybase SP which takes a date as the sole argument and

  • 0

I have a Sybase SP which takes a date as the sole argument and returns information about an order. I get the date from a JQuery datepicker on a CF page – which is formatted to yy-mm-dd. The SP defaults to getDate() when none is entered. When I enter a date on the form everything works fine. When I do not send a date – the date field is left blank – I get a CF error telling me that the argument is not of type date. I know the SP is sending a datetime value but how can I get the CF function to recognize it?

In the SP…

declare @order_dt datetime 

If @order_dt IS NULL
BEGIN
SELECT @order_dt = getDate()
END

In the cfc…

<cfargument name="order_dt" type="date" required="true" hint="order date to search for" >

and

 <cfprocparam type="In" cfsqltype="CF_SQL_DATE" dbvarname="@order_dt" value="#order_dt#" null="No">

On the .cfm page…

<!--JQuery datepicker  -->
<script type="text/javascript">
   $(function() {
           $("#datepicker").datepicker({ dateFormat: "yy-mm-dd" }).val()
   });

And the form looks like this:

<form id="xxxxForm">
<label for="date1">Pick a Date... </label>
<br>
<p><input type="text" id="datepicker" value="" name="date1"></p>
Then choose 'Search'...<br>
<input type="submit" name="submit" value="Search">
<br>
<br>

</form>

How can I get CF to recognize this as a good value? I was thinking perhaps if I declare @order_dt as just a date??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:43:30+00:00Added an answer on June 11, 2026 at 1:43 pm
    > <cfargument name="order_dt" type="date" required="true" 
    

    When you leave the date field blank, the submitted value is an empty string “”. An empty string is not a valid date. That is why CF complains when you try and invoke the function.

    As mentioned in the comments, you could use required="false" or default="#now()#". But for it to work as you expect, you must also omit the argument when the date is left blank. If you pass anything to the function, even an empty string, the default will not kick in. But validation will. So you will still get the same error.

    Another option is to change the argument type to string. Then validate inside the function. If the supplied value is not a valid date, either replace it with now()

       <cfargument name="order_dt" type="string" default="">
    
       <!--- simplistic date validation for illustration --->
       <cfif NOT isDate(arguments.order_dt)>
           <cfset arguments.order_dt = now()>
       </cfif>
    

    OR just pass NULL to the stored procedure

       <cfargument name="order_dt" type="string" default="">
       ...
    
       <cfprocparam type="In" value="#arguments.order_dt#" 
             null="#not isDate(arguments.order_dt)#" ....>
    

    On a side note, dbvarname was deprecated a while back. In recent versions it does nothing. Only positional parameters are supported.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a Database in Sybase, which we access from a Java server. Access
I have a simple query over a table, which returns results like the following:
We have a solution which is spread globally across a few Sybase DB servers
I have a stored procedure which takes as its parameter a varchar which needs
I have sybase stored procedures that I have written which we use in our
We have an user table which the userId is an uniqueidentifier type in Sybase
I'm migrating SPs from Sybase to SQL Server and I have a case where
I have been tasked with pulling out information (which appears to be just a
I have tested jconn2 and jconn3 on same application which is connected to sybase
So I have a Sybase stored proc that takes 1 parameter that's a comma

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.