Solved

Query

Posted on 2011-09-22
8
190 Views
Last Modified: 2012-06-22
Hi,

I have quer in sql and I want to convert it in MS access

update  YourTable
  Set   ColumnResult  =case when SUBSTRING(RIGHT(column1,7),1,2)='ws' then 'JK'
              when SUBSTRING(RIGHT(column1,7),1,2)='sa' then 'KR'
         end        
0
Comment
Question by:samprg
  • 3
  • 3
  • 2
8 Comments
 
LVL 39

Expert Comment

by:als315
ID: 36585035
IIF(mid(Right(column1,7),1,2)="ws", "JK", IIF(mid(Right(column1,7),1,2)="sa","KR",""))
0
 
LVL 39

Expert Comment

by:als315
ID: 36585054
Of full query (for Table1):
UPDATE Table1 SET Table1.ColumnResult = IIf(Mid(Right([column1],7),1,2)="ws","JK",IIf(Mid(Right([column1],7),1,2)="sa","KR",""));
0
 
LVL 39

Accepted Solution

by:
als315 earned 250 total points
ID: 36585056
For YourTable:
UPDATE YourTable SET YourTable.ColumnResult = IIf(Mid(Right([column1],7),1,2)="ws","JK",IIf(Mid(Right([column1],7),1,2)="sa","KR",""));
0
 
LVL 12

Expert Comment

by:pdebaets
ID: 36585065
update  YourTable Set   ColumnResult  = iif(Instr(1,RIGHT(column1,7),2)='ws,'JK',iif(Instr(1,RIGHT(column1,7),2)='sa','KR',""))
Where Instr(1,RIGHT(column1,7),2)='ws OR Instr(1,RIGHT(column1,7),2)='sa';
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

Author Comment

by:samprg
ID: 36585075
How can I use
IIF(mid(Right(column1,7),1,2)="ws", "JK", IIF(mid(Right(column1,7),1,2)="sa","KR",""))
in  update statement
0
 

Author Comment

by:samprg
ID: 36585085
I am sorry, I did not see your answers I should refresh IE.
I will try it
0
 
LVL 12

Assisted Solution

by:pdebaets
pdebaets earned 250 total points
ID: 36585094
My use of "Instr" is incorrect above. Please use

update  YourTable Set   ColumnResult  = iif(Mid(RIGHT(column1,7),1,2)='ws,'JK',iif(Mid(RIGHT(column1,7),1,2)='sa','KR',""))
Where Mid(RIGHT(column1,7),1,2)='ws OR Mid(RIGHT(column1,7),1,2)='sa';
0
 

Author Closing Comment

by:samprg
ID: 36590601
Awesome
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

863 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

24 Experts available now in Live!

Get 1:1 Help Now