Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: DBD::ODBC not support

by mje (Curate)
on May 12, 2010 at 15:11 UTC ( [id://839659]=note: print w/replies, xml ) Need Help??


in reply to Re^3: DBD::ODBC not support
in thread DBD::ODBC not support

The best way to pass datetimes to SQLServer via ODBC is using the ODBC syntax:

$sth->bind_param($param_n, q/{ts '1998-05-11 00:00:00'}/);

In your case you have an additional problem since the datetime parameters occur in a function so some MS SQL Server versions will be unable to describe the parameter correctly. As a result, if the parameter occurs in a function you might have to do the following to be sure it works:

$sth->bind_param($param_n, q/{ts '1998-05-11 00:00:00'}/, SQL_VARCHAR) +;

See ODBC Datetime Format.

I could go in to why using SQL_DATETIME is not a good idea but it would be rather lengthy. Perhaps I should write a FAQ on this for DBD::ODBC.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://839659]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2024-04-16 21:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found