By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

data conversion

P: 1
hi guys i have an sql query that alters a view by changing the data type of a column from varchar to int but keeps giving me this error "Conversion failed when converting the varchar value 'File N' to data type int." here is the sql query
Expand|Select|Wrap|Line Numbers
  2. AS 
  4. case when cast(left(right(IMPORT_RECORDS.whichfile,44),6)as integer) = '010182' then 'RD100'
  5. when cast(left(right(IMPORT_RECORDS.whichfile,44),6)as integer) = '010181' then 'RD99' else 0 end as 'MachineName'
  6. FROM Import_Records
May 7 '14 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 10K+
P: 12,349
Please use code tags when posting code or formatted data.

You are getting that error because you are trying to convert the string 'File N' to a number, which is impossible.
May 7 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.