We help IT Professionals succeed at work.
Get Started

T-SQL and SSRS:  Length of Text

Last Modified: 2014-05-01

Below is a snippet of my programming.  Please review the final field called "dfpin".

This programming is embedded in a view that is used by my SQL Reporting Services (SSRS) report.  

When I run the report, I generate it to a tab-delimited file.  Since Equifax requires that there be no special tabs, I use Find and Replace to remove said tabs.

In any case, here's the problem.  The attached Equifax file is a zipped Notepad file.  dfpin is to begin at position 392 in Notepad.  Instead, it is starting at position 380.  I'm twelve characters short.  Why is that?

An example of dfpin is in line three and begins with the phrase on that line "92081900".

It is incredibly important for Equifax that I get the positions of these fields correct.  I'm very surprised that the programming is not doing this.

Please help!



SELECT     'MED' AS company, CAST('202EMPLPIM' AS CHAR(15)) AS rectype,
CAST('16860' AS CHAR(16)) AS cocode,
AS ssn,
CAST(MED.dbo.UPR00100.EMPLOYID AS CHAR(64)) AS empl_id,
CAST(MED.dbo.UPR00100.SOCSCNUM AS CHAR(64)) AS user_id,
CAST('A868' AS CHAR(4))
AS inhousenum,
CONVERT(VARCHAR(8), MAX(MED.dbo.UPR00900.LSTPCKDT), 112) AS pasofdate,
                      CAST(MED.dbo.UPR00100.MIDLNAME AS CHAR(64)) AS mn,
                      CAST(MED.dbo.UPR00100.LASTNAME AS CHAR(64)) AS ln,
                      CAST('' AS CHAR(12)) AS suffix,
                      CAST('' AS CHAR(5)) AS title,
                      CAST(RTRIM(CAST(RIGHT(MED.dbo.UPR00100.SOCSCNUM, 10) AS VARCHAR(10))) + CAST(YEAR(MED.dbo.UPR00100.BRTHDATE) AS VARCHAR(4)) AS CHAR(8))
                      AS dfpin
Watch Question
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE