By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 972 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

converting access 2007 update query to sql server 2005 update query

P: 24
I ran this code on my access 07 db and it updates a number of records 61,425, I try and run the query in SQL Server 2005 modifying the IIf to CASE WHEN and I get a number of sytax errors.

Original code

UPDATE tblShipments
SET tblShipments.[Order Type] = IIf([EDI TP Id] Like "web*","WEB",
IIf([FrctStndRte 1/0]=1,"EDI",IIf([EDI TP Id] Is Null,"MAN","EDI")));

Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'Like'.

I got that when I compiled it and it won't execute. Any suggestions on how I should modify the code to get the fields FrctStndRte 1/0 and EDI TP Id to update.
Aug 31 '09 #1
Share this Question
Share on Google+
3 Replies


ck9663
Expert 2.5K+
P: 2,878
Could you post the SQL Server version of your code?

--- CK
Aug 31 '09 #2

P: 24
UPDATE tblShipments
SET tblShipments.[Order Type] = IIf([EDI TP Id] Like "web*","WEB",
IIf([FrctStndRte 1/0]=1,"EDI",IIf([EDI TP Id] Is Null,"MAN","EDI")));
Sep 1 '09 #3

ck9663
Expert 2.5K+
P: 2,878
SQL Server does not have IIF. Use CASE..WHEN instead.

Search the syntax in BOL.

Good luck!!

--- CK
Sep 1 '09 #4

Post your reply

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