Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

data type conversion

Posted on 2008-06-17
8
Medium Priority
?
179 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
  • 4
  • 2
7 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

810 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