Rx_
Nothing In Moderation
- Local time
- Today, 11:19
- Joined
- Oct 22, 2009
- Messages
- 2,803
The single record view uses this:
ISNULL(dbo.APD_Stips1.Stip_Abv, N' ') + N' ' + N'(' + ISNULL(dbo.APD_Stips2.Dt_Start, N' ') + N' ' + ISNULL(dbo.APD_Stips2.Dt_End, N' ' + N')') + N')'
SQL Server 2008r2
Most of the three fields have a Stips Code, a begin period, a end period.
In most cases the code above returns something like this: BO (03/01 08/15)
In the case where there is a code, but the Begin period and End period are empty, it returns one of the two formats.
Actual example: mostly this PM ( ) and sometimes this CL ( ))
The desired output would be this: PM
In MSACCESS or a later version of SQL the IF statement would make this easy.
How would this be done in SQL Server 2008r2?
My first preference is to get rid of any () that have no dates and leave the (5/10 6/30) ones there.
ISNULL(dbo.APD_Stips1.Stip_Abv, N' ') + N' ' + N'(' + ISNULL(dbo.APD_Stips2.Dt_Start, N' ') + N' ' + ISNULL(dbo.APD_Stips2.Dt_End, N' ' + N')') + N')'
SQL Server 2008r2
Most of the three fields have a Stips Code, a begin period, a end period.
In most cases the code above returns something like this: BO (03/01 08/15)
In the case where there is a code, but the Begin period and End period are empty, it returns one of the two formats.
Actual example: mostly this PM ( ) and sometimes this CL ( ))
The desired output would be this: PM
In MSACCESS or a later version of SQL the IF statement would make this easy.
How would this be done in SQL Server 2008r2?
My first preference is to get rid of any () that have no dates and leave the (5/10 6/30) ones there.
Attachments
Last edited: