in reply to perl DBI error

The first I'd do would be to check whether the sql statement actually *is* the same:

warn $sqlarr[2];

And assuming you have two placeholders, include the contents of $reportstartdt and $reportenddt.

You probably already tried this, but I thought I should mention it anyway.

Get the result and put it into sql server to see if it really runs.

If that still doesn't solve the problem... well, try pasting the sql statement here, or even the part of your code that generates that statement. It's a bit hard trying to find a bug in code we can't see :-)