Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 datatype convertion in populated table

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-17 : 08:18:35
mark keene writes "I need to convert the datatype of two columns in a table from varchar to datetime. the trouble is the table contains approx 1000 records. I have tried doing an selected insert into another table but get the error convertion of datatype has resulted in an out of range datetime value. All of the existing data (varchars) are have the following format 17/12/02 (i'm in the uk).

Can you help. Is there a convertion function that will format the varchar so that it stay within range or is there a really simple explanation to this?

I'm use SQL server 7 with the latest service packs.

Many thanks,

Mark"

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2002-06-17 : 08:27:33
Mark,

Take a look at CAST and CONVERT....

Peace

Rick

Go to Top of Page

dsdeming

479 Posts

Posted - 2002-06-17 : 08:42:19
Also try something like this to find out which of your rows contain data that won't convert easily:

SELECT YourColumnName
FROM Table
WHERE ISDATE( YourColumnName ) = 0

Go to Top of Page
   

- Advertisement -