Sql select statement with if then

I have a if then else statment that is a small portion of a larger statement but i cant seem to figure out syntax.  here is what i am looking for.

select (if por1.U_SIF_Vendprom = null then por1.shipdate else por1.U_SIF_Vendprom) as REQDATE from por1

Who is Participating?
Patrick MatthewsConnect With a Mentor Commented:
select CASE WHEN por1.U_SIF_Vendprom IS NULL then por1.shipdate else por1.U_SIF_Vendprom END as REQDATE from por1

select ISNULL(por1.U_SIF_Vendprom, por1.shipdate) as REQDATE from por1
SharathData EngineerCommented:
Is the data type of vendprom and shipdate same? you can also try COALESCE.

select COALESCE(por1.U_SIF_Vendprom, por1.shipdate) as REQDATE from por1
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.