• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 59
  • Last Modified:

Change a value of 1 to YES

sql server linked table - "Detail_YORN" - (nvarchar(5)   text in access

In a query :
I have a field called  "Detail_YORN"
I need to change the Value of "1" to "YES"
AND
change the value of "2" to "NO"

Thanks
fordraiders
0
Fordraiders
Asked:
Fordraiders
  • 2
  • 2
1 Solution
 
Paul MacDonaldDirector, Information SystemsCommented:
Something like...

SELECT
    CASE
        WHEN Detail_YORN = 1 THEN 'YES'
        ELSE 'NO'
    END AS YorNAnswer
FROM table
0
 
Fabrice LambertFabrice LambertCommented:
Hello,

Run 2 update queries:

UPDATE Detail_YORN
SET Detail_YORN = 'YES'
WHERE Detail_YORN = '1'

Same goes for the "NO" values, change the query accordingly.
0
 
FordraidersAuthor Commented:
got this to work also in the query
=IIf([Detail_YORN] = True, "Yes", "No")  In the criteria for the field i'm trying to change the value.

fordraiders
0
 
Fabrice LambertFabrice LambertCommented:
Well, keep in mind that most of the time, computers deal with boolean values as follow:
- 0 is False.
- If it isn't False, then it is True.
- Usually, True is -1 by default.

And since your Detail_YORN field is a text field, comparing it with a boolean make no sens.

The following will work better:
=IIf([Detail_YORN] = "1", "Yes", "No")

But beware that any value different from "1" will be replaced by "False".
If that isn't your desired results, the iif operator isn't the solution you need.
0
 
FordraidersAuthor Commented:
Thanks very much !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now