FullName

  • How to identify if the first word is the foundation or bank bring full name with t-sql?

  • mario.rbrandao (8/13/2013)


    How to identify if the first word is the foundation or bank bring full name with t-sql?

    Huh???

    _______________________________________________________________

    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/

  • More accurate than the first part of the name:

    foundations

    banks

    Any suggestions on how we can identify that the first word is the foundation or bank bring full name?

    TABLE

    FUNDAÇAO XXX

    BANCO BNP PARIBAS BRASIL S/A

    BANCO J. SAFRA S.A.

    RIO BRAVO INVESTIMENTOS LTDA

  • You could use the CASE statement to look at the first few characters and build a number of rules to differentiate between the two.

    You would have to review this regularly to see if it's correctly identifying the two. There's no guarantee that it will always work, unless the names always follow the rules.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Please have any examples of how this can be case?

  • mario.rbrandao (8/13/2013)


    More accurate than the first part of the name:

    foundations

    banks

    Any suggestions on how we can identify that the first word is the foundation or bank bring full name?

    TABLE

    FUNDAÇAO XXX

    BANCO BNP PARIBAS BRASIL S/A

    BANCO J. SAFRA S.A.

    RIO BRAVO INVESTIMENTOS LTDA

    are there any other columns in this table that might assist with identification.....all we have is a pseudo table with a single column.

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • mario.rbrandao (8/13/2013)


    More accurate than the first part of the name:

    foundations

    banks

    Any suggestions on how we can identify that the first word is the foundation or bank bring full name?

    TABLE

    FUNDAÇAO XXX

    BANCO BNP PARIBAS BRASIL S/A

    BANCO J. SAFRA S.A.

    RIO BRAVO INVESTIMENTOS LTDA

    Do you want to identify banks in English or Portugese ?

  • Portuguese.

  • If you're still looking this may help:

    declare @Table table (Name Varchar(50));

    insert @Table values ( 'Something' );

    insert @Table values ( 'Else' );

    insert @Table values ( 'Banco Central' );

    insert @Table values ( 'Banco el Norte' );

    insert @Table values ( 'FUNDAÇAO XXX' );

    insert @Table values ( 'FundaÇAO XXX' );

    insert @Table values ( 'BANCO BNP PARIBAS BRASIL S/A' );

    insert @Table values ( 'Else2' );

    insert @Table values ( 'BANCO J. SAFRA S.A.' );

    insert @Table values ( 'RIO BRAVO INVESTIMENTOS LTDA' );

    insert @Table values ( 'XXX FUNDAÇAO XXX' );

    insert @Table values ( 'YYY Banco YYY' );

    --select * from @Table

    -- Picks out names that start with BANCO OR FUNDAÇAO

    select Name

    from @Table

    where Name like 'BANCO%' or Name like 'FUNDAÇAO%'

    -- Picks out names that contain BANCO OR FUNDAÇAO

    -- Only use this if you need to as it will prevent the optimiser using the Name index, if there is one.

    select Name

    from @Table

    where Name like '%BANCO%' or Name like '%FUNDAÇAO%'

  • Without the actual table schema and naming rules/business logic, and any other tables that might help, the only accurate solutions all involve redesigning your schema so banks and foundations are clearly distinct, either by a type column, separate tables for each, or or some other means (a table to join to that has a type column, etc.).

Viewing 10 posts - 1 through 9 (of 9 total)

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