If...then in .adp queries

G

Guest

I just started working with .adp files and faced a problem. In the old .mdb
files I created the following field in a query:

HelpFieldA: IIF([FieldA]>1,[FieldA],[FieldB])

How do I make the equivalent in a .adp query?

Thanks...

GB, DK
 
S

Stefan Hoffmann

hi,
I just started working with .adp files and faced a problem. In the old .mdb
files I created the following field in a query:
HelpFieldA: IIF([FieldA]>1,[FieldA],[FieldB])
How do I make the equivalent in a .adp query?
You are no longer writing queries. So you have to use the SQL Server
syntax called T-SQL:

CASE WHEN [FieldA]>1 THEN [FieldA] ELSE [FieldB] END

Take a look at CASE in the T-SQL documentation or in any kind of MSDN
Library.


mfG
--> stefan <--
 
G

Guest

Thank you, it works just perfect.

I must admit that I already got a documented example from witch I made the
following:
CASE [FieldA] WHEN 1 THEN [FieldA] ELSE [FieldB] END
Works perfect...

Next step
CASE [FieldA] WHEN >1 THEN [FieldA] ELSE [FieldB] END
Dosn't work at all...
With your example it is obvious. Thanks again :)



Stefan Hoffmann said:
hi,
I just started working with .adp files and faced a problem. In the old .mdb
files I created the following field in a query:
HelpFieldA: IIF([FieldA]>1,[FieldA],[FieldB])
How do I make the equivalent in a .adp query?
You are no longer writing queries. So you have to use the SQL Server
syntax called T-SQL:

CASE WHEN [FieldA]>1 THEN [FieldA] ELSE [FieldB] END

Take a look at CASE in the T-SQL documentation or in any kind of MSDN
Library.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top