?
Solved

SQL Conversion error

Posted on 2014-11-11
3
Medium Priority
?
57 Views
Last Modified: 2014-11-20
When i run the following query i get an error: 'Conversion failed when converting the varchar value '%' to data type int.'

SELECT
      [FileCount] + '%'      
  FROM [Document]

How do i convert?
0
Comment
Question by:vbnetcoder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 2000 total points
ID: 40434803
By using either Cast or CONVERT - see http://technet.microsoft.com/en-us/library/aa226054(v=sql.80).aspx for more information.

SELECT CAST([FileCount] as varchar(16)) + "%"
  FROM [Document]

Open in new window

0
 
LVL 40

Expert Comment

by:lcohan
ID: 40435917
-- Or like below but mind you is the [FileCount] really a percentage or you need to calculate that

SELECT cast([FileCount] as sysname) + '%'  AS FileCount FROM [Document];
0
 

Author Closing Comment

by:vbnetcoder
ID: 40455371
ty
0

Featured Post

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question