|
subhi
Starting Member
9 Posts |
Posted - 2010-03-11 : 13:20:56
|
| SELECT --left(replicate(' ',10)+cast(RS_REFERRAL_ID as varchar(10)),10)+left(replicate(' ',8)+cast(RS_BUDGET_GROUP_NO_FAMILY_NO as varchar(8)),8)+ --left(replicate(' ',2)+cast(RS_MEDICAID_RECIPIENTS_COUNTY as varchar(2)),2) left(cast(isnull(rs_referral_id,'') as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(RS_BUDGET_GROUP_NO_FAMILY_NO,'')as varchar(8))+replicate(' ',8),8)+ left(cast(isnull(RS_MEDICAID_RECIPIENTS_COUNTY,'')as varchar(2))+replicate(' ',2),2)+ right(replicate(' ',10)+ cast(isnull(RS_CSES_CASE_ID,'')as varchar(10)),10)+ left(cast(isnull(RS_CSES_CASE_STATUS,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(RS_CASEWORKER_LAST_NAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(RS_CASEWORKER_FIRST_NAME,'')as varchar(18))+replicate(' ',18),18)+ left(cast(isnull(RS_CASEWORKER_MIDDLE_NAME,'')as varchar(15))+replicate(' ',15),15)+ left(cast(isnull(RS_CASEWORKER_SUFFIX,'')as varchar(10))+replicate(' ',4),4)+ left(cast(isnull(RS_CASEWORKER_PHONE_NUMBER,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(RS_CASEWORKER_COUNTY,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(RS_DATE_REFERRED_TO_CSES,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(RS_PAYMENT_CATEGORY,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(RS_MEDICAID_CASE_STATUS,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(RS_GOOD_CAUSE_EXISTS,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(RS_GOOD_CAUSE_APPROVED,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(RS_ASSIGNMENT_OF_RIGHTS_DATE,'')as varchar(10))+replicate(' ',10),10) + left(cast(isnull(temps2_MEDICAID_CP_ID,'')as varchar(19))+replicate(' ',19),19)+ right(replicate('0',10)+cast(isnull(temps2_CSES_MEMBER_ID,'0')as varchar(10)),10)+ left(cast(isnull(temps2_LAST_NAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(temps2_FIRST_NAME,'')as varchar(18))+replicate(' ',18),18)+ left(cast(isnull(temps2_MIDDLE_NAME,'')as varchar(15))+replicate(' ',15),15)+ left(cast(isnull(temps2_SUFFIX,'')as varchar(4))+replicate(' ',4),4)+ left(cast(isnull(temps2_MAIDEN_NAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(temps2_SSN,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(temps2_DATE_OF_BIRTH,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(temps2_GENDER,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(temps2_RACE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(temps2_CP_AND_temp_LIVING_TOGETHER,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(temps2_CP_NON_COOPERATIVE,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(temps2_RES_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(temps2_RES_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(temps2_RES_ADDRESS_LINE_3,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(temps2_RES_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(temps2_RES_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(temps2_RES_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(temps2_HOME_PHONE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(temps2_MAIL_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(temps2_MAIL_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(temps2_MAIL_ADDRESS_LINE_3,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(temps2_MAIL_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(temps2_MAIL_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(temps2_MAIL_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(temps2_EMPLOYER_NAME,'')as varchar(50))+replicate(' ',50),50)+ left(cast(isnull(temps2_EMPLOYER_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(temps2_EMPLOYER_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(temps2_EMPLOYER_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(temps2_EMPLOYER_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(temps2_EMPLOYER_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(temps2_WORK_PHONE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(temps2_WORK_SHIFT,'')as varchar(20))+replicate(' ',20),20)+ left(cast(isnull(temps2_CURRENT_MARITAL_STATUS,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(temps2_SPOUSE_LAST_NAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(temps2_SPOUSE_FIRST_NAME,'')as varchar(18))+replicate(' ',18),18)+ left(cast(isnull(temps2_SPOUSE_MIDDLE_NAME,'')as varchar(15))+replicate(' ',15),15)+ left(cast(isnull(temps2_SPOUSE_SUFFIX,'')as varchar(4))+replicate(' ',4),4)+ left(cast(isnull(temps2_DATE_OF_MARRIAGE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(temps2_MARRIAGE_COUNTRY,'')as varchar(30))+replicate(' ',30),30)+ left(cast(isnull(temps2_MARRIAGE_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(temps2_MARRIAGE_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(temps2_DATE_OF_DIVORCE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(temps2_DATE_OF_DEATH,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(temps2_ATTORNEYS_LAST_NAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(temps2_ATTORNEYS_FIRST_NAME,'')as varchar(18))+replicate(' ',18),18)+ left(cast(isnull(temps2_ATTORNEYS_MIDDLE_NAME,'')as varchar(15))+replicate(' ',15),15)+ left(cast(isnull(temps2_ATTORNEYS_SUFFIX,'')as varchar(4))+replicate(' ',4),4)+ left(cast(isnull(temps2_ELIGIBILITY_START_DATE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(temps2_ELIGIBILITY_END_DATE,'')as varchar(10))+replicate(' ',10),10) + '*** CHild Segment ***' + left(cast(isnull(CS01,' ')as varchar(824))+replicate(' ',824),824)+ '***1' + left(cast(isnull(CS02,' ')as varchar(824))+replicate(' ',824),824)+ '***2' + left(cast(isnull(CS03,' ')as varchar(824))+replicate(' ',824),824)+ '***3' + left(cast(isnull(CS04,' ')as varchar(824))+replicate(' ',824),824)+ '***4' + left(cast(isnull(CS05,' ')as varchar(824))+replicate(' ',824),824)+ '***5' + left(cast(isnull(CS06,' ')as varchar(824))+replicate(' ',824),824)+ '***6' + left(cast(isnull(CS07,' ')as varchar(824))+replicate(' ',824),824)+ '***7' + left(cast(isnull(CS08,' ')as varchar(824))+replicate(' ',824),824)+ '***8' + left(cast(isnull(CS09,' ')as varchar(824))+replicate(' ',824),824)+ '***9' + left(cast(isnull(CS10,' ')as varchar(824))+replicate(' ',824),824)+ '***11' + left(cast(isnull(CS11,' ')as varchar(824))+replicate(' ',824),824)+ '***22' + left(cast(isnull(CS12,' ')as varchar(824))+replicate(' ',824),824)+ '***33' + left(cast(isnull(CS13,' ')as varchar(824))+replicate(' ',824),824)+ '***44' + left(cast(isnull(CS14,' ')as varchar(824))+replicate(' ',824),824)+ '***55' + left(cast(isnull(CS15,' ')as varchar(824))+replicate(' ',824),824)+ '***66' + left(cast(isnull(CS16,' ')as varchar(824))+replicate(' ',824),824)+ '***77' + left(cast(isnull(CS17,' ')as varchar(824))+replicate(' ',824),824)+ '***88' + left(cast(isnull(CS18,' ')as varchar(824))+replicate(' ',824),824)+ '***99' + left(cast(isnull(CS19,' ')as varchar(824))+replicate(' ',824),824)+ '***111' + left(cast(isnull(CS20,' ')as varchar(824))+replicate(' ',824),824)+ '***222' + left(cast(isnull(CS21,' ')as varchar(824))+replicate(' ',824),824)+ '***333' + left(cast(isnull(CS22,' ')as varchar(824))+replicate(' ',824),824)+ '***444' + left(cast(isnull(CS23,' ')as varchar(824))+replicate(' ',824),824)+ '***555' + left(cast(isnull(CS24,' ')as varchar(824))+replicate(' ',824),824)+ '***666' + left(cast(isnull(CS25,' ')as varchar(824))+replicate(' ',824),824) + '*** temp Segment ***' + left(cast(ntemps2s_referral_id as varchar(10))+replicate(' ',10),10) + --left(cast(isnull(tempS_BUDGET_GROUP_NUMBER,'')+ right(replicate('0',10)+cast(isnull(tempS_CSES_member_ID,'0')as varchar(10)),10)+ --right(cast(isnull(tempS_CSES_CASE_ID,'')+ --left(cast(isnull(tempS_CSES_MEMBER_ID,'')+ left(cast(isnull(tempS_LAST_NAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_FIRST_NAME,'')as varchar(18))+replicate(' ',18),18)+ left(cast(isnull(tempS_MIDDLE_NAME,'')as varchar(15))+replicate(' ',15),15)+ left(cast(isnull(tempS_SUFFIX,'')as varchar(4))+replicate(' ',4),4)+ left(cast(isnull(tempS_ALIAS,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_NICKNAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_MAIDEN_NAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_SSN,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(tempS_DATE_OF_BIRTH,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_DATE_OF_DEATH,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_COUNTRY_OF_BIRTH,'')as varchar(30))+replicate(' ',30),30)+ left(cast(isnull(tempS_CITY_OF_BIRTH,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_STATE_OF_BIRTH,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_GENDER,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(tempS_RACE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_DRIVERS_LICENSE_NUMBER,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_ISSUE_DATE,'')as varchar(10))+replicate(' ',10),10) + left(cast(isnull(tempS_EXPIRATION_DATE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_CURRENT_MARITAL_STATUS,'')as varchar(1))+replicate(' ',1),1)+ right(replicate(' ',1)+cast(isnull(tempS_HEIGHT_FT,'')as varchar(1)),1)+ right(replicate(' ',2)+cast(isnull(tempS_HEIGHT_IN,'')as varchar(2)),2)+ right(replicate(' ',3)+cast(isnull(tempS_WEIGHT_LBS,'')as varchar(3)),3)+ left(cast(isnull(tempS_HAIR_COLOR,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_EYE_COLOR,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_IDENTIFYING_MARK_SCARS,'')as varchar(30))+replicate(' ',30),30)+ left(cast(isnull(tempS_RESIDENTIAL_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_RESIDENTIAL_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_RESIDENTIAL_ADDRESS_LINE_3,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_RESIDENTIAL_ADDRESS_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_RESIDENTIAL_ADDRESS_STATe,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_RESIDENTIAL_ADDRESS_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(tempS_RESIDENTIAL_ADDRESS_DATE_LAST_LIVED,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_RESIDENTIAL_ADDRESS_HOME_PHONE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_MAILING_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_MAILING_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_MAILING_ADDRESS_LINE_3,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_MAILING_CITY,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(tempS_MAILING_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_MAILING_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(tempS_PREVIOUS_ADDRESS_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_PREVIOUS_ADDRESS_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_PREVIOUS_ADDRESS_ADDRESS_LINE_3,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_PREVIOUS_ADDRESS_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_PREVIOUS_ADDRESS_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_PREVIOUS_ADDRESS_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(tempS_LAST_EMPLOYER_NAME,'')as varchar(50))+replicate(' ',50),50)+ left(cast(isnull(tempS_LAST_EMPLOYER_COUNTRY,'')as varchar(30))+replicate(' ',30),30) + left(cast(isnull(tempS_LAST_EMPLOYER_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_LAST_EMPLOYER_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_LAST_EMPLOYER_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_LAST_EMPLOYER_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_LAST_EMPLOYER_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(tempS_LAST_EMPLOYER_WORK_PHONE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_LAST_EMPLOYER_DATE_LAST_WORKED,'')as varchar(10))+replicate(' ',10),10)+ right(replicate(' ',9)+cast(isnull(tempS_LAST_EMPLOYER_MONTHLY_SALARY,' ')as varchar(9)),9) + left(cast(isnull(tempS_LAST_EMPLOYER_USUAL_OCCUPATION,'')as varchar(30))+replicate(' ',30),30)+ left(cast(isnull(tempS_PAST_EMPLOYER_NAME,'')as varchar(50))+replicate(' ',50),50)+ left(cast(isnull(tempS_PAST_EMPLOYER_DATE_LAST_WORKED,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_PAST_EMPLOYER_COUNTRY,'')as varchar(30))+replicate(' ',30),30)+ left(cast(isnull(tempS_PAST_EMPLOYER_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_PAST_EMPLOYER_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_PAST_EMPLOYER_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_PAST_EMPLOYER_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_PAST_EMPLOYER_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(tempS_FATHERS_LAST_NAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_FATHERS_FIRST_NAME,'')as varchar(18))+replicate(' ',18),18)+ left(cast(isnull(tempS_FATHERS_MIDDLE_NAME,'')as varchar(15))+replicate(' ',15),15)+ left(cast(isnull(tempS_FATHERS_SUFFIX,'')as varchar(4))+replicate(' ',4),4)+ left(cast(isnull(tempS_FATHERS_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_FATHERS_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_FATHERS_ADDRESS_LINE_3,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_FATHERS_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_FATHERS_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_FATHERS_ZIP,'')as varchar(9))+replicate(' ',9),9) + left(cast(isnull(tempS_FATHERS_PHONE_NUMBER,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_MOTHERS_LAST_NAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_MOTHERS_FIRST_NAME,'')as varchar(18))+replicate(' ',18),18)+ left(cast(isnull(tempS_MOTHERS_MIDDLE_NAME,'')as varchar(15))+replicate(' ',15),15)+ left(cast(isnull(tempS_MOTHERS_SUFFIX,'')as varchar(4))+replicate(' ',4),4)+ left(cast(isnull(tempS_MOTHERS_MAIDEN_NAME,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_MOTHERS_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_MOTHERS_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40) + left(cast(isnull(tempS_MOTHERS_ADDRESS_LINE_3,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_MOTHERS_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_MOTHERS_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_MOTHERS_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(tempS_MOTHERS_PHONE_NUMBER,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_LAST_SCHOOL_ATTENDED_NAME,'')as varchar(50))+replicate(' ',50),50)+ left(cast(isnull(tempS_LAST_SCHOOL_COUNTRY,'')as varchar(30))+replicate(' ',30),30)+ left(cast(isnull(tempS_LAST_SCHOOL_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_LAST_SCHOOL_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_LAST_SCHOOL_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_LAST_SCHOOL_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_LAST_SCHOOL_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(tempS_ARREST_HAS_A_POLICE_RECORD,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(tempS_ARREST_DATE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_ARREST_OFFENSE,'')as varchar(30))+replicate(' ',30),30)+ left(cast(isnull(tempS_ARREST_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_ARREST_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_INCARCERATION_DATE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_INCARCERATION_RELEASE_DATE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_INCARCERATION_FACILITY_NAME,'')as varchar(30))+replicate(' ',30),30)+ left(cast(isnull(tempS_INCARCERATION_ADDRESS_LINE_1,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_INCARCERATION_ADDRESS_LINE_2,'')as varchar(40))+replicate(' ',40),40)+ left(cast(isnull(tempS_INCARCERATION_CITY,'')as varchar(25))+replicate(' ',25),25)+ left(cast(isnull(tempS_INCARCERATION_STATE,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_INCARCERATION_ZIP,'')as varchar(9))+replicate(' ',9),9)+ left(cast(isnull(tempS_ARMED_FORCES_STATUS,'')as varchar(1))+replicate(' ',1),1)+ left(cast(isnull(tempS_ARMED_FORCES_VA_SERVICE_NUMBER,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_ARMED_FORCES_BRANCH,'')as varchar(2))+replicate(' ',2),2)+ left(cast(isnull(tempS_ARMED_FORCES_ENTRY_DATE,'')as varchar(10))+replicate(' ',10),10)+ left(cast(isnull(tempS_ARMED_FORCES_DISCHARGE_DATE,'')as varchar(10))+replicate(' ',10),10)--+ FROM tmp_table where id = 99why i am concatinate is i want to create a flat file . this part of code since in flat each record will be 32,000 bytes but i am getting only 8000 bytes or 4000 . i am wondering why is this ? advance thanks for your reply. |
|