SQL Tutorial - How to create a Dynamic Pivot in SQL Part 2

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 17

  • @getvdp
    @getvdp ปีที่แล้ว +2

    Brad, really appreciate you taking time and sharing your knowledge, your videos are really helpful.

    • @BeardedDevData
      @BeardedDevData  ปีที่แล้ว +1

      No problem, glad that you find them useful.

  • @houstonvanhoy7767
    @houstonvanhoy7767 ปีที่แล้ว +1

    What a relief! This is like going from straight drive to automatic. 😊

  • @singuyen5927
    @singuyen5927 2 ปีที่แล้ว +1

    Lately I’ve been using a lot of stringagg of a distinct list. Making it dynamic like how you showed will be another great tool in the bag. Thank you so much!

  • @houstonvanhoy7767
    @houstonvanhoy7767 ปีที่แล้ว +1

    Brad: Your LinkedIn profile shows an impressive list of Microsoft certifications.
    When you have time, please do a video on what SQL Server certifications are still valid and worthwhile, and what to leave behind at this point in time - early 2023. Thanks.

    • @BeardedDevData
      @BeardedDevData  ปีที่แล้ว

      I do need to do some videos on certifications, it's something I have invested a lot of time into.

  • @maryk.larson8555
    @maryk.larson8555 ปีที่แล้ว +1

    Another great, incredibly helpful, easy to follow video - thank you! Question about STRING_AGG: I and my colleagues occasionally run into circumstances where the list it brings back is non-unique - i.e., there are duplicates in it, inexplicably; we cannot get STRING_AGG to work and must result to using STUFF (yuck). This doesn't seem to happen if it's used in a CTE or main query that calls data from a preceding CTE, (or apparently a derived table, like you use here). Is there a general rule of thumb for avoiding duplicates in the aggregated string when using STRING_AGG? (Perhaps you've covered this already in another video?)

    • @BeardedDevData
      @BeardedDevData  ปีที่แล้ว

      Hi, you are correct, as far as I'm aware STRING_AGG will include duplicates and they need to be handled separately.

  • @aunad___
    @aunad___ 9 หลายเดือนก่อน +1

    Hey Brad! Thank you for this. My code works, but now I want to save the result as a view. how do i do that?

    • @BeardedDevData
      @BeardedDevData  9 หลายเดือนก่อน

      Unfortunately you wouldn't be able to run this code within a View because it's a dynamic query, you need to use a Stored Procedure.

  • @maulishriagrawal1875
    @maulishriagrawal1875 2 หลายเดือนก่อน

    Can Null be removed from the output value. i have currently hardcoded IsNull along with cols name. Can we make dynamic query including IsNull??

    • @BeardedDevData
      @BeardedDevData  2 หลายเดือนก่อน

      I think it could work, you can't remove NULLs though, only replace.

  • @beegoodstewards
    @beegoodstewards ปีที่แล้ว +1

    thanks buddy!

  • @nimeshkotadia6526
    @nimeshkotadia6526 2 ปีที่แล้ว +1

    How to order by the dynamic list of columns?

    • @BeardedDevData
      @BeardedDevData  2 ปีที่แล้ว +1

      You can just add the column list to the ORDER BY, ORDER BY CustomerId,' + @Columns or you can actually hard code some values if you only want to order by some of the columns

  • @source-454
    @source-454 2 หลายเดือนก่อน +1

    very nice thanks u very much