469,590 Members | 2,464 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,590 developers. It's quick & easy.

Convert Access quey to SQL statement

How to convert following MS access quey to SQL server statement

ACCESS:
Testx: IIf(Mid(dbo_ITMaster!City,1,2)="AB",IIf(Mid(dbo_IT Master!Plan,1,3)<>"XYZ","M",IIf(dbo_ITMaster!Cente r="1111", "A", IIf(dbo_ITMaster!Center="2222","C",IIf(dbo_ITMaste r!Center="3333",IIf(dbo_ITMaster!Zip=23456,"A","B" ),IIf(dbo_ITMaster!Sop="ABC","Z"," "))))))



MY SQL STATEMENT:
Testx = CASE
WHEN SUBSTRING([ITMaster].[Section],1,2) = 'AB' AND
SUBSTRING([ITMaster].[MastPlanFam],1,3)<>'XYZ' THEN 'M'
WHEN [ITMaster].[center] = '1111' THEN 'A'
WHEN [ITMaster].[center] = '2222' THEN 'C'
WHEN [ITMaster].[center] = '3333' AND
[ITMaster].[Vendor] = 23456 THEN 'A' ELSE 'B'
WHEN [ITMaster].[Sop] = 'ABC' THEN 'Z' ELSE '' END

UP TO HERE IT WI WORKING FINE
Aug 14 '08 #1
1 1461
ck9663
2,878 Expert 2GB
Looks like you have 2 "ELSE"

-- CK
Aug 14 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by ian m via SQLMonster.com | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.