L. Szozda

My feedback

  1. 28 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  SQL Server » Suggestions  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda commented  · 

    I strongly aggree that SQL Server should support this feature(it is available in PostgreSQL UNNEST() WITH ORDINALITY).

    As a workaround OPENJSON and KEY could be used:

    DECLARE @str NVARCHAR(MAX) = 'Ben|10, Bob|325, Susan|7, Michael|99';

    SELECT s.col, PersonName, Amount,rn,
    RunningTotal = SUM(Amount) OVER(ORDER BY rn ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
    FROM (SELECT @str) s(col)
    CROSS APPLY (SELECT
    PersonName = LEFT(TRIM(Value), CHARINDEX('|', TRIM (Value))-1)
    ,Amount = CAST(RIGHT(TRIM(Value), CHARINDEX('|', REVERSE (TRIM(Value)))-1) AS INT)
    ,value
    ,rn = [key]
    FROM OPENJSON(JSON_QUERY(
    REPLACE(CONCAT('["',s.col,'"]'), ', ', '","')))
    ) A;

    https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=74b6144f702edcffce5e338c0686cd00

    Full story: https://stackoverflow.com/questions/56742851/join-together-multiple-columns-split-by-a-character-in-sql/56742939#56742939

    L. Szozda supported this idea  · 
  2. 17 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  SQL Data Warehouse » Polybase  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
  3. 26 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  SQL Data Warehouse » T-SQL  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
  4. 47 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    planned  ·  0 comments  ·  SQL Data Warehouse » T-SQL  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
  5. 71 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    planned  ·  6 comments  ·  SQL Data Warehouse » T-SQL  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
  6. 74 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    4 comments  ·  SQL Data Warehouse » Polybase  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
  7. 107 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    under review  ·  3 comments  ·  SQL Data Warehouse » T-SQL  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
  8. 168 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    10 comments  ·  SQL Data Warehouse » Other  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
  9. 340 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    16 comments  ·  SQL Data Warehouse » T-SQL  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
  10. 91 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    12 comments  ·  SQL Server » Suggestions  ·  Flag idea as inappropriate…  ·  Admin →

    Upvotes: 3

    <=-=Jan 8 2018 12:16PM=-=>

    Thanks for the suggestion.
    We’ll consider it for a future release.

    Are there specific limitations imposed when you have the filegroup, e.g., no database snapshot, that hold you back from creating the filegroup?
    Or is it only the feeling of not being able to turn back?


    Jos de Bruijn – Database Systems PM

    L. Szozda supported this idea  · 
  11. 151 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    9 comments  ·  SQL Server » Suggestions  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
  12. 193 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    8 comments  ·  SQL Server » Suggestions  ·  Flag idea as inappropriate…  ·  Admin →

    Upvotes: 72

    <=-=Mar 10 2016 11:26AM=-=>

    It’s a shame that this was submitted as just a “suggestion”. It should actually be listed as a “bug” because there’s only a comparatively small set of use cases where enumeration of the result set of elements is not important.

    <=-=Mar 11 2016 12:47PM=-=>

    I agree that an order column is required; one example use case is where two lists are passed in, and ordinal positions in one list correspond to positions in the other.

    <=-=Mar 11 2016 3:12PM=-=>

    Please see the related suggestion: STRING_SPLIT needs “RemoveEmptyEntries” option, like String.Split in .NET ( https://connect.microsoft.com/SQLServer/feedback/details/2462002/ ).

    <=-=Mar 12 2016 12:02PM=-=>

    This kind of function is primarily needed for de-serializing previously serialized arrays of values of any type format-able as text.
    I therefore recommend to have the result set of this function work excellent with this use-case.

    With de-serialized arrays there is a need to…

    L. Szozda supported this idea  · 
  13. 256 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    7 comments  ·  SQL Server » Suggestions  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda commented  · 

    This feature is a real game changer and allows to implement things that were virtually impossible/unreadable.

    One more example is capping running total: https://stackoverflow.com/a/53994970/5070879

    L. Szozda supported this idea  · 
  14. 2 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  SQL Server » Suggestions  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda shared this idea  · 
  15. 12 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  SQL Server » Bugs  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
    L. Szozda commented  · 

    Workaround - adding blanks for each expression:

    ;WITH personFruits
    AS
    (
    SELECT 'John' AS [Person], 'Apple' AS [Fruit] UNION
    SELECT 'John' AS [Person], 'Banana' AS [Fruit] UNION
    SELECT 'John' AS [Person], 'Kiwi' AS [Fruit] UNION
    SELECT 'Jane' AS [Person], 'Apple' AS [Fruit] UNION
    SELECT 'Jane' AS [Person], 'Strawberry' AS [Fruit] UNION
    SELECT 'Jane' AS [Person], 'Watermellon' AS [Fruit] UNION
    SELECT 'Jane' AS [Person], 'Grape' AS [Fruit] UNION
    SELECT 'Dale' AS [Person], 'Kiwi' AS [Fruit] UNION
    SELECT 'Dale' AS [Person], 'Watermellon' AS [Fruit]
    )
    SELECT
    p.Person
    ,STRING_AGG(p.Fruit, ', ') WITHIN GROUP (ORDER BY p.Fruit) AS [FruitsWithComma]
    ,STRING_AGG(''+p.Fruit, '; ') WITHIN GROUP (ORDER BY p.Fruit) AS [FruitsWithSemicolon]
    ,STRING_AGG('' + '' + p.Fruit, ' - ') WITHIN GROUP (ORDER BY p.Fruit) AS [FruitsWithDash]
    FROM
    personFruits AS p
    GROUP BY
    p.Person
    ORDER BY
    p.Person

    https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=b13d8d262884d0f2b703e7a7845746ef

    Kudos: https://stackoverflow.com/questions/52533487/string-agg-not-behaving-as-expected/52534215#52534215

  16. 3 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  SQL Server » Bugs  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda shared this idea  · 
  17. 1 vote
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  SQL Server » Bugs  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda shared this idea  · 
  18. 6 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  SQL Server » Bugs  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda supported this idea  · 
  19. 4 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    4 comments  ·  SQL Server » Bugs  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda commented  · 

    In my opinion there is no error here because your query is logically equivalent to:

    delete from foo where JobHistoryId in (select JobHistoryId from #data)
    <=>
    delete from foo where JobHistoryId in (select foo.JobHistoryId from #data)

    You should always prefix table columns:

    delete from foo where JobHistoryId in (select #data.JobHistoryId from #data)

    https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=ca1f5784a3bd08389cf3a4dc2cc484bf

    Similar question on SO: https://stackoverflow.com/a/50955287

  20. 2 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  SQL Server » Bugs  ·  Flag idea as inappropriate…  ·  Admin →
    L. Szozda shared this idea  · 
← Previous 1

Feedback and Knowledge Base