Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[Microsoft][ODBC SQL Server Driver]Error in row0

Status
Not open for further replies.
Apr 11, 2000
38
GB
I have the following piece of SQL which takes a datetime database column containing values like 13/11/2001 07:25:23
and attempts to convert it into a date 13/11/2001.

SELECT
convert(smalldatetime,(convert(varchar,qrepository.dbo.contact.createtime,103)))
FROM
qrepository.dbo.contact

I get the message '[Microsoft][ODBC SQL Server Driver]Error in row0'. Does anyone have any suggestions?

cheers,

Nick
 
Try adding the length specification to the varchar datatype.

varchar(10) should do it.

Also what you see displayed when you select a datetime column is just the default display, it has nothing to do with what is stored. To get 13/11/2001 displayed for the date today just

SELECT CONVERT(VARCHAR(10), getDate(), 103)
 
Well, I tried that, but with a select statement like this:

SELECT
convert(smalldatetime,(convert(varchar(10),qrepository.dbo.contact.createtime,103)))
FROM
qrepository.dbo.contact

I got the same error. Typical values in this column are

1/11/2001 09:57:23
29/10/2001 10:57:55

Any ideas?
Nick
ndaniels@ventura-uk.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top