Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
shyamprasad76
Starting Member
38 Posts |
Posted - 2001-11-26 : 11:32:06
|
| Hi,Below is the select statement written in MS-Access. I want to re-write the same in Sql Server 7.0. Obviously there is no IIF statement in SQL Server. I know that 'CASE' must be a substitute. I had hard time writing this using CASE in SQL Server 7.0. Can any one please help me in completeing this. (may be using CASE construct.)Thanks in advance,Shyam.SELECT IIf(Mid([CustID],6,8)="000",Trim([CustomerName]) & " (" & [CustID] & ")",Trim([BillingDepartmentName]) & " (" & [CustId] & ")") AS N, IIf([N]=Trim([CustomerName]) & " (" & [CustID] & ")",IIf([CMID],[CMID],"Total"),Trim([CustomerName]) & " (" & Left([CustID],5) & ")") AS C1, IIf([C1]="Total","",IIf([C1]=Trim([CustomerName]) & " (" & Left([CustID],5) & ")",IIf([CMID],[CMID],"Total"))) AS C2, IIf([C2]=[CMID],"Total","") AS C3, dbo_Customer.BranchName, dbo_Customer.ActivationDate, dbo_Customer.ARBalance, dbo_Customer.DSO, dbo_Customer.CustID FROM dbo_Customer; |
|
|
|
|
|
|
|