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.
| Author |
Topic |
|
ejoeyz_85
Yak Posting Veteran
54 Posts |
Posted - 2008-01-12 : 18:40:18
|
| below is my sql query statement... hope u understandSELECT u.User_fname, pv.PV_address, p.Start_monitoring, p.Last_monitoring, p.Period_of_monitoring, m.Ongoing_maintenance, m.Savings_for_inverter_replacement, m.Monitoring, m.Total_anual_maint_and_monitorFROM PerformanceData p, MonitoringCost m, Photovoltaic pv, Users uWHERE p.Performance_id=m.MonitoringCost_id and pv.PV_id=p.Performance_id and pv.PV_id=m.MonitoringCost_id and u.User_id =p.Performance_id and u.User_id =pv.PV_id and u.User_id = m.MonitoringCost_idwhen i execute this query, it cannot executed because i got this error message... Msg 245, Level 16, State 1, Line 1Conversion failed when converting the varchar value 'ejoy' to data type int.what should i do?? |
|
|
jonathant
Starting Member
6 Posts |
Posted - 2008-01-12 : 19:14:53
|
quote: Originally posted by ejoeyz_85 below is my sql query statement... hope u understandSELECT u.User_fname, pv.PV_address, p.Start_monitoring, p.Last_monitoring, p.Period_of_monitoring, m.Ongoing_maintenance, m.Savings_for_inverter_replacement, m.Monitoring, m.Total_anual_maint_and_monitorFROM PerformanceData p, MonitoringCost m, Photovoltaic pv, Users uWHERE p.Performance_id=m.MonitoringCost_id and pv.PV_id=p.Performance_id and pv.PV_id=m.MonitoringCost_id and u.User_id =p.Performance_id and u.User_id =pv.PV_id and u.User_id = m.MonitoringCost_idwhen i execute this query, it cannot executed because i got this error message... Msg 245, Level 16, State 1, Line 1Conversion failed when converting the varchar value 'ejoy' to data type int.what should i do??
Two of the columns that you are joining are different data types. The value in the varchar field "ejoy" can't be converted to an integer for comparison.Jonathan |
 |
|
|
ejoeyz_85
Yak Posting Veteran
54 Posts |
Posted - 2008-01-12 : 19:26:40
|
| how to convert varchar to int? |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-01-12 : 19:46:26
|
| Use convert function if varchar column has numbers only. |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-01-12 : 20:10:44
|
| The statement you posted doesn't contain any reference to a column called [ejoy]. The error must be from a different statement. Perhaps one of your tables is really a VIEW?Be One with the OptimizerTG |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|
|
|
|