Hi All, I am porting an old MS access system to MS SQL and I am having a slight problem porting the SQL code to the server.
I am using a View in MS SQL server.
I have cust the expression down to just the one field I am trying to deal with, however I am having a few syntax problems, could someone possibly help me?
SELECT Ship_To, If(Substring([Ship_To],1,2)="05","BMW","") AS Expr1
FROM Master;
This is very easy to do in MS Access, I am unsure what I am doing wrong!
MS SQL If Substring and EXPR1
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Jan 31, 2013, 6:23 AM EST
SELECT Ship_To,
Case When Substring([Ship_To],1,2)='05' Then 'BMW'
Else '' END AS Expr1
FROM Master
Guest User13 reputationPosted Jan 31, 2013, 7:35 AM EST