[freetds] conversion of a char data type to a datetime data

Lowden, James K LowdenJK at bernstein.com
Tue Oct 4 09:53:27 EDT 2005


> From: Brad
> Sent: Tuesday, October 04, 2005 7:48 AM
> 
> I am trying to run a "select" on a read-only table in a (Spanish)
> database (on an MS SQL server).
> 
> There is a column with dates ("fecha") in it.
> 
> If this column is selected, I get the following message:
> 
> ---- tsql output ----
> 1> select * from calendarios 
> 2> go
> url    fecha    visible_en_web
> Msg 242, Level 16, State 3, Server INTRANET, Line 7
> The conversion of a char data type to a datetime data type resulted
> in an out-of-range datetime value.
> ---- end tsql output ----
> 
> And no data is actually displayed.
> 
> Any ideas as to why this might be happening? 

Bizarre.  Something is going on, server-side.  Question 1: Line 7 of
what?  You issued a 1-line query.  

I think your table has a computed column or is perhaps a function or
view?  

> I would not really
> expect to get that kind of error message unless I am updating or
> inserting...

Exactly.  Unless you have something like this:

1> set ansi_warnings on
2> go
1> create view v as
2> select getdate() as now
3> union
4> select cast('Aug 4 878' as datetime)
5> go
1> select now from v
2> go
Msg 242, Level 16, State 3, Server AC2KAMA0848, Line 1
The conversion of a char data type to a datetime data type resulted in
an out-of-range datetime value.

HTH.

--jkl

-----------------------------------------
The information contained in this transmission may be privileged and
confidential and is intended only for the use of the person(s) named
above. If you are not the intended recipient, or an employee or agent responsible
for delivering this message to the intended recipient, any review, dissemination,
distribution or duplication of this communication is strictly prohibited. If you are
not the intended recipient, please contact the sender immediately by reply e-mail
and destroy all copies of the original message. Please note that we do not accept
account orders and/or instructions by e-mail, and therefore will not be responsible
for carrying out such orders and/or instructions.  If you, as the intended recipient
of this message, the purpose of which is to inform and update our clients, prospects
and consultants of developments relating to our services and products, would not
like to receive further e-mail correspondence from the sender, please "reply" to the
sender indicating your wishes.  In the U.S.: 1345 Avenue of the Americas, New York,
NY 10105.



More information about the FreeTDS mailing list