SQL Query | Split concatenated string into columns | STRING_SPLIT function

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024

Комментарии • 42

  • @ebenbrittz535
    @ebenbrittz535 3 года назад +4

    One of the (if not the most) most underrated SQL videos I have ever seen.

  • @hindermanrinconrubio6062
    @hindermanrinconrubio6062 3 года назад +3

    After searching for many hours, I found a teacher. Thanks

  • @abcxyz6606
    @abcxyz6606 3 года назад +1

    Perfect! This is exactly what I'm looking for - cross apply split function to get the F/L name in row. Thank you!

  • @siouxperirish
    @siouxperirish Месяц назад

    Thank you for the excellent explanation. I have a further complication with a concatenation string which is delimited by a series of pipes and parenthesis. With the value between the first pipe and parenthesis of varying length. The parenthesis is fixed and the distance between the close parenthesis and last pipe is also fixed.

  • @rprasad8271
    @rprasad8271 3 года назад +1

    Thank u very much, Plz put more videos like this, Really very helpful.

  • @amolnaranje6598
    @amolnaranje6598 2 года назад

    appreciate your way of teaching, really simple to understand.
    Keep up the good work

  • @kristyowens2284
    @kristyowens2284 4 года назад +2

    This is really useful.

  • @carlfercho
    @carlfercho 2 года назад

    Wow es el metodo más rápido que he encontrado, es muy veloz y no consume recursos. Gracias!!!

  • @sibanipanda7750
    @sibanipanda7750 9 месяцев назад

    nicely explained .. but row_number is an analytical function not an aggregate function

  • @prashantx19
    @prashantx19 3 года назад

    I have got what I was looking for .. Thanks... 😎

  • @kristyowens2284
    @kristyowens2284 4 года назад +2

    Thank you for sharing this.

  • @hv0032113
    @hv0032113 4 года назад +1

    Good collection of sql functions

  • @saktibiswal6445
    @saktibiswal6445 Год назад

    Thank you for this awesome lesson!

  • @sunilmadgi4234
    @sunilmadgi4234 2 года назад +1

    i have 3 tables
    01) table employee (columns are empid,empname , depid)
    02) table Department ( columns are depid, dep name)
    03) table salary (columns are empid,amount,month).
    Q) get the empname , how don't get the salary in the month of December
    please let me know the concept for this questions , how to solve

    • @LearnatKnowstar
      @LearnatKnowstar  2 года назад

      You can filter table 3 records for month - December. Th n do a left join between table 1 and filtered table 3 records. The records which do not exist in table 3 are the employees who did not get salary in December. We will post a video with solution soon.

  • @inhlam5909
    @inhlam5909 2 года назад

    1. Select value from string_split(string/column, delimiter)
    2. Select value from table CROSS APPLY string_split(string/column, delimiter)
    3. Select [1] AS .., [2] AS .., .. From CTE_Table
    PIVOT (
    Function ..
    For column in ([1], [2],.. )
    ) AS PivotTable

  • @solomong.gebrhana1204
    @solomong.gebrhana1204 Год назад

    what if we have 4 strings to extract? what is the best function to use? I am using SQL Server 2012 and we don't have the split function.

  • @mnsyakir
    @mnsyakir 4 месяца назад

    What if the name contains more than 3 name? Please reply, i need it

  • @english_speaking
    @english_speaking 2 месяца назад

    Is there any another method to do this ?

  • @shuiji7387
    @shuiji7387 Год назад

    Hello! I'm having issue with this since my Table has a Value column name and is there a way to cast a column name for the CROSS APPLY SPLIT_STRING() to different name?

  • @arturbezerra4994
    @arturbezerra4994 3 года назад +1

    How could I transform a single column, where each row contains a string with 6 values separated by a comma, into 6 columns?
    Existing table:
    Unique column
    value1, value2, value3, value4, value5, value6
    value A, value B, value C, value D, value E, value F
    ...

    • @LearnatKnowstar
      @LearnatKnowstar  3 года назад +2

      You can try the same approach. It will work for multiple columns.

  • @stuartbird2951
    @stuartbird2951 3 года назад

    Can this be saved as a View for regular use? When I paste it into a view I get a syntax error "SQL text cannot be represented in the grid pane and diagram pane."

  • @shami621
    @shami621 Год назад

    string split function was introduced in SQL 2017, but I want to do it in SQL 2014, how can I do that? I want to split values on specific characters because my column have multiple values

  • @akjay143
    @akjay143 2 года назад

    Why you have used this approach ? When we can solve it by substring & charIndex function only
    Select substring(name,1charindex(‘,’,name)-1) lastname, substring(name,charIndex(‘,’,name)+1,len(name)) from table

  • @nareshj506
    @nareshj506 2 года назад +1

    I want to use delimiter as line feed

    • @LearnatKnowstar
      @LearnatKnowstar  2 года назад +1

      You can use Char(10) as the delimiter. Char(10) means line feed.

    • @nareshj506
      @nareshj506 2 года назад

      @@LearnatKnowstar thank you for the reply ! Had found it thanks

  • @petermaina7111
    @petermaina7111 3 года назад

    i have a column with a mix-up of 2 delimiters i.e. (;) and (|) and are not uniform in length, e.g
    1 row has I=2551;A=5075;D=20120815
    2 row has I=2166;A=4407.64;D=20120531|I=2500;A=90192.36;D=20120801
    and this can be longer as per the allocations but each main part is separated by (|)
    i want to extract parts namely I=character.
    how do i do it since they are not uniform?

    • @sukumar44
      @sukumar44 3 года назад +1

      As you have a variable table, your problem statement is a bit complex for split string or any other SQL function. But you can search for Python data frame for this.

  • @jinji6161
    @jinji6161 Год назад

    String spilt is not working in SQL2019

  • @msureshbabu15
    @msureshbabu15 Год назад

    ❤helped me