Solved

SQL Conversion error

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

691 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