try:
my $sth = $dbh->prepare( "set dateformat dmy" )|| die $dbh->errstr;
#to see if it's puking on prepare
or
$dbh->do( "set dateformat dmy" ) || die $dbh->errstr;
# this is the format I've learned to use for setting
# session params.
Daniel Kasak wrote:
Hi all.
The SQL Server docs say that you can instruct SQL Server to interpret
dates in the format you want ( for example in insert statements ) by
issuing the command:
set dateformat xxx
where xxx is the format string, for example dmy
So I'm doing:
my $sth = $dbh->prepate( "set dateformat dmy" );
$sth->execute || die $dbh->errstr;
$sth->finish;
This code runs without error, but doesn't seem to affect the way SQL
Server interprets dates that I give it. ie I'm still getting stuff like:
DBD::ODBC::st execute failed: [unixODBC][FreeTDS][SQL Server]The
conversion of a char data type to a datetime data type resulted in an
out-of-range datetime value.
What am I doing wrong?