Solved

SQL Conversion error

Posted on 2014-11-11
3
53 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft Access Delete all Records from table but Max 2 28
SQL Syntax 24 54
Accessing variables in MySQL query 4 55
SQL Query--is not excluding a segment of my data 4 18
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

749 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