If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Decode function
Dear all,
I'm just new in access databases (using MSaccess 2003) I've a native application generating an sql code against an oracle database. I 'd like to use this code in access via a linked table but my sql using a "decode" function (transforming 1 into "Y" and 0 into "No". What would be the equivalent via access? Thanks in advance TT |
#2
|
|||
|
|||
Decode function
You can just write a public function in VB that does the conversion.
The function will accept 1 or 0 as a parameter and return Y or No. Call the function from your query. -- Dorian "Give someone a fish and they eat for a day; teach someone to fish and they eat for a lifetime". " wrote: Dear all, I'm just new in access databases (using MSaccess 2003) I've a native application generating an sql code against an oracle database. I 'd like to use this code in access via a linked table but my sql using a "decode" function (transforming 1 into "Y" and 0 into "No". What would be the equivalent via access? Thanks in advance TT |
#3
|
|||
|
|||
Decode function
You could use IIF like this --
IIF([YourField] = 1, "Y", "No") unless there maybe other entries besides 1 and 0. Then this -- IIF([YourField] = 1, "Y", IIF([YourField] = 0, "No", "Error"))) -- Build a little, test a little. " wrote: Dear all, I'm just new in access databases (using MSaccess 2003) I've a native application generating an sql code against an oracle database. I 'd like to use this code in access via a linked table but my sql using a "decode" function (transforming 1 into "Y" and 0 into "No". What would be the equivalent via access? Thanks in advance TT |
#4
|
|||
|
|||
Decode function
On Sep 28, 5:23*pm, KARL DEWEY
wrote: You could use IIF like this -- * * * IIF([YourField] = 1, "Y", "No") * *unless there maybe other entries besides 1 and 0. *Then this -- * * * IIF([YourField] = 1, "Y", IIF([YourField] = 0, "No", "Error"))) -- Build a little, test a little. " wrote: Dear all, I'm just new in access databases (using MSaccess 2003) I've a native application generating an sql code against an oracle database. I 'd like to use this code in access via a linked table but my sql using a "decode" function (transforming 1 into "Y" and 0 into "No". What would be the equivalent via access? Thanks in advance TT- Hide quoted text - - Show quoted text - works perfect ! THanks |
Thread Tools | |
Display Modes | |
|
|