I am trying to compare two tables (Current Software, Recommended Software) that fraught with trailing 'blank miscellaneous' strings in most records being compared. For some reason I cannot alter or delete the trailing invisible spaces or blank characters in the fields being compared in SQL server (unless I am doing something wrong).
I've even tried exporting the effected table records to MS excel, manually removing the trailing blank strings, deleting it physically using the delete key, and updating the tables. No such luck and totally baffled. So I've decided to have the query perhaps "TRIM" the records being compared on the fly.
Question: Is there a way I can simply modify the following query to compare two tables with NO trailing blank strings in either records in SQL?
This is the query
SELECT dbo.VIEW_CURRENT_SOFTWARE_BYVER.SRV_ID_SSI, dbo.VIEW_CURRENT_SOFTWARE_BYVER.SRV_MACID, dbo.VIEW_CURRENT_SOFTWARE_BYVER.SRV_DN, dbo.VIEW_CURRENT_SOFTWARE_BYVER.DISPLAYNAME,
dbo.VIEW_CURRENT_SOFTWARE_BYVER.DISPLAYVERSION, dbo.VIEW_CURRENT_SOFTWARE_BYVER.VALOVERRIDE, dbo.VIEW_RECOMMENDED_SOFTWARE_BYVER.SRV_UPDATEDVERSION,
CASE WHEN [VIEW_CURRENT_SOFTWARE_BYVER].[DISPLAYVERSION] = '' AND
[VIEW_RECOMMENDED_SOFTWARE_BYVER].[SRV_UPDATEDVERSION] = '' THEN 'No Version Available' WHEN [VIEW_CURRENT_SOFTWARE_BYVER].[DISPLAYVERSION] IS NOT NULL AND
[VIEW_RECOMMENDED_SOFTWARE_BYVER].[SRV_UPDATEDVERSION] IS NULL
THEN 'Evaluation Required' WHEN [VIEW_CURRENT_SOFTWARE_BYVER].[DISPLAYVERSION] = [VIEW_RECOMMENDED_SOFTWARE_BYVER].[SRV_UPDATEDVERSION] THEN 'Current' WHEN [VIEW_CURRENT_SOFTWARE_BYVER].[DISPLAYVERSION]
!= [VIEW_RECOMMENDED_SOFTWARE_BYVER].[SRV_UPDATEDVERSION] THEN 'Requires Update' ELSE 'Error' END AS SRV_RECOMMENDATION, dbo.VIEW_CURRENT_SOFTWARE_BYVER.RELEASE,
dbo.VIEW_CURRENT_SOFTWARE_BYVER.PUBLISHER, dbo.VIEW_CURRENT_SOFTWARE_BYVER.INSTALLDATE
FROM dbo.VIEW_CURRENT_SOFTWARE_BYVER LEFT OUTER JOIN
dbo.VIEW_RECOMMENDED_SOFTWARE_BYVER ON dbo.VIEW_CURRENT_SOFTWARE_BYVER.DISPLAYNAME = dbo.VIEW_RECOMMENDED_SOFTWARE_BYVER.SRV_CMBNAME
GO
Where
VIEW_CURRENT_SOFTWARE_BYVER.DISPLAYNAME (varchar(max) and VIEW_RECOMMENDED_SOFTWARE_BYVER.SRV_CMBNAME (char(215) fields contain the annoying trailing blank strings that result in them not marrying up correctly in the query.
Thanks in advance