in reply to Place Holders and SQL convert

Does your SQL work if you replace the placeholder ? by your intended column value?

Looking at some random Sybase documentation, I don't find the value 120 documented as a valid format specifier for convert(...). I don't find any value corresponding to yyyy-mm-dd, but you should not need one anyway, because the default for dates is yyyy-mm-dd.

If something else changes this value, you can maybe change it back by using:

set temporary option date_format 'YYYY-MM-DD';

Replies are listed 'Best First'.
Re^2: Place Holders and SQL convert
by Anonymous Monk on Sep 17, 2015 at 18:06 UTC
    It could be this for MS SQL Server:
    SELECT convert(datetime, '10-23-2016', 110) -- mm-dd-yyyy

    But is the Perl format looked OK?

      I am really, really confused.

      The error message you get is from your SQL server. It has nothing to do with Perl.

      You cannot change your data format without also changing your data. In your first example, you have yyyy-mm-dd, in this example you have mm-dd-yyyy . You will need to decide on one format and then check that both, your data and the other arguments to convert() match that.

Re^2: Place Holders and SQL convert
by Anonymous Monk on Sep 17, 2015 at 18:10 UTC
    The dates are coming in this format:
    05/30/2015

      Please make up your mind as to what format your data is in. Then consult again the documentation for the convert() function in your SQL server. Then re-read Re^3: Place Holders and SQL convert.

        Question is, if the dates are coming in this format:
        yyyy/mm/dd
        would the sql CONVERT work the way it has been in the sample code?