Solved

SQL Conversion error

Posted on 2014-11-11
3
49 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
3 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
Comment Utility
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 39

Expert Comment

by:lcohan
Comment Utility
-- 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
Comment Utility
ty
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now