Hi every body, i design a system that read some data from ms sql database but i get this error when i try to exectue this query: select id,name from emp; the error: Warning: MS SQL message: Conversion failed when converting the nvarchar value '2_10' to data type int. (severity 16) in c:\apache\htdocs\test\update.php on line 38 I search in the internet for a solution to this problem and I find this: the query should by change from this: select id,name from emp; to : select cast(id as nvarchar),cast(name as nvarchar) from emp; but this solution did not work and i still get that error. Please help if you have any idea?
I've not come across this before and I'm no expert but... Is that the exact SQL you're using to extract the data? It seems to me that there's a where clause missing because of what the error is reporting... Or there's some data in the id field that isn't of the correct type configured for the table... If you have a value of 2_10 in your id field and it's configured to be INT then that's why you may be seeing an error - because 2_10 isn't an integer... Sounds like you've got bad data in that field... I'm only guessing tho.... Can you cut-n-paste some example data from your table?