Solved

data type conversion

Posted on 2008-06-17
8
171 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
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 43 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 2

Assisted Solution

by:matty1stop
matty1stop earned 86 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 86 total points
ID: 21803085
That doesn't work.  try this:

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

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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

17 Experts available now in Live!

Get 1:1 Help Now