| Author |
Topic |
|
PeeJay2583
Starting Member
40 Posts |
Posted - 2011-05-12 : 10:37:00
|
| Hi,I am trying to insert data from one table to another however getting an error message "Msg 241, Level 16, State 1, Line 1Conversion failed when converting datetime from character string."I have checked the datatype is the same in both the tables also number of fields are matching, don't understand where the problem is occuring. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-05-12 : 10:41:38
|
You must be wrong.If source and destination column both of datatype datetime then this error cannot happen. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2011-05-12 : 10:42:08
|
| Does target and source columns order is same??--------------------------http://connectsql.blogspot.com/ |
 |
|
|
PeeJay2583
Starting Member
40 Posts |
Posted - 2011-05-12 : 10:49:26
|
| You were right webfred. got the error now. thanks!Mukesh Sajjan |
 |
|
|
PeeJay2583
Starting Member
40 Posts |
Posted - 2011-05-12 : 10:51:35
|
| One question......I have one field as datetime in one table and other table doesn't have same field so I am putting as 'na' in that field therefore its giving me the above error message. how can i correct this? |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-05-12 : 10:54:22
|
Try to replace 'na' by NULL (without single quotes)If that doesn't help then please show us the create table statements and your query so far. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
PeeJay2583
Starting Member
40 Posts |
Posted - 2011-05-12 : 11:00:49
|
| It works webfred. you are a star!Mukesh Sajjan |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-05-16 : 09:19:35
|
| Note that empty string on datetime column will default to 19000101MadhivananFailing to plan is Planning to fail |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|