in reply to DBI::ODBC Stored Procedure execution

As to your first question, put single quotes around the date string:

my $sql = qq|usp_Dashboard_CallType \@start = '20080101' |; my $sp = $msdbh->prepare($sql);

Replies are listed 'Best First'.
Re^2: DBI::ODBC Stored Procedure execution
by hallikpapa (Scribe) on Jan 27, 2008 at 19:40 UTC
    That worked perfectly. Thank you. May I ask how you just know when to use single quote, double, or none? I would like to read more about that somewhere. Thanks again!

      As far as I'm aware, it's specified in the SQL standard - the following is lifted from Joe Celko's "SQL For Smarties" book (recommended, btw):

      In SQL, character strings are printable characters enclosed in single quotation marks. ... Double quotations marks are reserved for column names that have embedded spaces or that are also SQL-reserved words.

      Without the quotes, you're passing a number a bit larger than 20 million to the stored procedure (which is left unconverted, even though it looks like a date). With the quotes, SQL Server is clever enough to try to convert the string to a date, so it does what you mean. You can, if you want, explicitly control how the conversion gets done using CAST: http://msdn2.microsoft.com/en-us/library/ms141704.aspx.

      Hope that helps.