Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

iif statements and format() in T-SQL

Status
Not open for further replies.

SeadnaS

Programmer
May 30, 2011
214
Hi,

I have transferred some tables to a my SQL Server 2008 backend and need to modify some queries. I was told to use a pass through query so im trying to convert the Jet SQL to T SQL but I don't know what to do with these iif statements.

EXP_D:
IIf(IsNull([EXP_DATE2]),"",IIf([EXP_DATE2]="","",Trim([EXP_DATE2])))

and

MM: IIf([EXP_D]="",Format(Now(),"yyyy/mm"),IIf(IsNull([EXP_D]),Format(Now(),"yyyy/mm"),Format([EXP_D],"yyyy/mm")))

I am aware that I need to use CASE but i really don't know how to apply it to these iif statements.

Any help much appreciated!

Seadna.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top