data type conversion

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
sriramb69Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

matty1stopCommented:
what is the datatype of your VALUE field?
0
Aneesh RetnakaranDatabase AdministratorCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sriramb69Author Commented:
data type of value field is int
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

matty1stopCommented:
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
sriramb69Author Commented:
On the scorecard how do i display as 'n/a' where there is no value.
I want to only display and not update
0
matty1stopCommented:
select isnull(value, 'N/A')
from #Scorecard
0
matty1stopCommented:
That doesn't work.  try this:

select
isnull(cast(value as varchar(512)), 'N/A')
from #Scorecard
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.