• rtrice (2/7/2014)


    qta-subbld4-swt1-ups1qta-sub-bldg4-swt1-ups1.domain<-should show

    qta-lr-china-hssp-ups1qta-china-hssp-ups1.domain<-should show

    sha-cab67-ups1.domainsha-cab67-ups1.domain<-should NOT how, but does

    sha-cab78-ups1.domainsha-cab78-ups1.domain<-should NOT how, but does

    sha-cab4009-pdu1.doaminsha-cab4009-ups1.domain<-should show

    There you go

    Thanks

    There is nothing like insert statements, and this is nothing like insert statements. Please understand that we want to help you but we don't have tables or data to work with. Is this two columns in a table, is this a single column with multiple values?

    Please take a few minutes and read the first link in my signature for best practices when posting questions. Yours is pretty simple but we can't help with coding because we can't write it ourselves.

    BTW, you said you are new to sql. You should stop the habit immediately of using ordinal position in your order by. Use the column name instead. The benefits are two fold. First you don't have to start counting columns to see which column it is (does it start with 0 or 1? that is a question you need to know 100%). Secondly, you don't have to change your order by if you change the order of columns in the query.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/