Set field length

  • I have this little query, it is being imported into SQL.

    My end user would like the 'ecd or emm' field to be a set length (output).

    How do I set that?

    SELECT DISTINCT

    'ecd or emm',

    rm.rim_no,

    rm.last_name,

    rm.first_name,

    rm.email_1,

    ra.address_line_1,

    ra.address_line_2,

    ra.address_line_3,

    ra.city,

    ra.state,

    ra.zip,

    rm.branch_no

    FROM

    ##ELECTRONIC e (nolock)

    --inner join[ssds_core_msphxx.lydianprivatebank.com\core].msphxx.dbo.dp_acct dp (nolock)

    --on dp.rim_no = e.rim_no

    --inner join [ssds_core_msphxx.lydianprivatebank.com\core].msphxx.dbo.dp_display dd (nolock)

    --on dp.acct_no = dd.acct_no and dp.class_code = dd.class_code

    inner join [ssds_core_msphxx.lydianprivatebank.com\core].msphxx.dbo.rm_acct rm (nolock)

    on rm.rim_no = e.rim_no

    inner join [ssds_core_msphxx.lydianprivatebank.com\core].msphxx.dbo.rm_address ra (nolock)

    on ra.rim_no = e.rim_no and ra.addr_type_id = 1

    --left join [ssds_core_msphxx.lydianprivatebank.com\core].msphxx.dbo.ad_dp_cls adc (nolock)

    --on adc.class_code = dp.class_code

  • do you mean like this:

    SELECT DISTINCT

    CONVERT(CHAR(50),'ecd or emm') AS RESULTS,

    ...

    so that it is say, 50 chars, padded with whitespace?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks Lowell!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply