Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

data type conversion

Posted on 2008-06-17
8
Medium Priority
?
178 Views
Last Modified: 2010-03-19
SqlServer
update   #Scorecard
set value = 'N/A' where value = ' '

This gives Error --
Error converting data type varchar to numeric.
pls someone give me a solution
0
Comment
Question by:sriramb69
[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
  • 4
  • 2
8 Comments
 
LVL 2

Expert Comment

by:matty1stop
ID: 21802775
what is the datatype of your VALUE field?
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 172 total points
ID: 21802801
you cant assign a value like 'N/A' which is varchar, to a numeric field , so instead of updating the value field, you can display it as  'N/A'  while showing the values or else you can update as NULL

SqlServer
update   #Scorecard
set value =null  where value = ' '
0
 

Author Comment

by:sriramb69
ID: 21802821
data type of value field is int
0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 2

Assisted Solution

by:matty1stop
matty1stop earned 344 total points
ID: 21802859
You can't assign a string like 'N/A' to an int field.  As the error message states it fails when it tries to convert 'N/A' to a type of int.
0
 

Author Comment

by:sriramb69
ID: 21802934
On the scorecard how do i display as 'n/a' where there is no value.
I want to only display and not update
0
 
LVL 2

Expert Comment

by:matty1stop
ID: 21802981
select isnull(value, 'N/A')
from #Scorecard
0
 
LVL 2

Assisted Solution

by:matty1stop
matty1stop earned 344 total points
ID: 21803085
That doesn't work.  try this:

select
isnull(cast(value as varchar(512)), 'N/A')
from #Scorecard
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

609 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