I need to compare a right justified character field to an integer field:I am bulding a temp file that contains business units (from DB2/400). Both fields are 12 char and right justified in the tableCREATE TABLE #AuthorityTable ( busunit_from char(12), busunit_to char(12) )INSERT #AuthorityTable ( busunit_from, busunit_to )SELECT msmcuf, msmcutFROM OPENQUERY(vgsys400, 'SELECT * FROM vgisec.f0001')WHERE msuser = @UserID
Here is the compare. Field dbo.Job.CompanyJobId is an integer:INNER JOIN #AuthorityTable AS at ON at.busunit_from <= dbo.Job.CompanyJobId AND at.busunit_to >= dbo.Job.CompanyJobId