Forum Replies Created

Viewing 15 posts - 46 through 60 (of 827 total)

  • Reply To: Row and Page Compression Facts

    From your link:

    Compression can allow more rows to be stored on a page, but does not change the maximum row size of a table or index.

    So, the "Compression can allow...

  • Reply To: Choosing Rows or Range

    Please, post an example with RANGE!

    I tried this one, so the right answer is PARTITION BY:

    SELECT SUM(object_id)OVER()

    ,SUM(object_id)OVER(PARTITION BY NULL)

    FROM sys.objects

    WHERE object_id < 100

  • Reply To: Create a Tally Function (fnTally)

    I use this function with recursion and @top of 1000000 is enough for me, but I don't n know if it performs better:

    -- by Carlo.Romagnano

    CREATE FUNCTION dbo.fn_tally(@top INT)

    RETURNS TABLE

    AS

    RETURN WITH...

  • Reply To: Sorting in R

    Explanation doesn't match with the "pseudo correct" answer.

    From documentation:

    The "radix" method generally outperforms the other methods, especially for character vectors and small integers. Compared to quick sort, it is slightly...

  • Reply To: More Which in R

    Little typo: newletters vs new_letters

    newletters<- c("q","w", "e", "r", "t", "y", "u", "i", "o", "p", "q", "w", "e" )

    > which (new_letters=="q")

  • Reply To: How Many Rows Inserted?

    "In this code, the SET IMPLICIT TRANSACTIONS ON sets a @@trancount of 1. I am not sure why this occurs, but it means that after the COMMIT, there is still...

  • Reply To: Parameters in RAISERROR

    -- correct

    declare @d tinyint = NULL

    RAISERROR(' %s is the current value', 1, 0, @d)

     

    -- incorrect

    declare @d tinyint = 1

    RAISERROR(' %s is the current value', 1, 0, @d)

  • Reply To: Adding N/A

    You can avoid COALESCE with this code:

    SELECT *

    ,LAG(CAST(b AS VARCHAR(10)),1,'N/A')over(ORDER BY a,b)

    FROM (VALUES

    ('a',1)

    ,('b',2)

    ,('c',3)

    ,('d',4)

    ) AS V([a],)

    -- P.S. I did not test for performance.

  • Reply To: Adding Extended Properties to Tables

    A little typo:

    name, value, level0 type of schema, level0 value of dbo, level1type of table and level1name of dbo.Adverts.

    level1name should be only the name of table without the schema.

  • Reply To: The Order of Operations

    That's right!

    It's good to know.

    Here's to force the minus precedence:

    SELECT (-100.0)/(-100.0)*10.0

     

  • Reply To: The IDENTITY Column Property

    The increment also is out of transactions. So, rollback doesn't restore the original value.

    Also, you can not remove the property IDENTITY from a column.

    This adds the IDENTITY to a column:

    ALTER...

  • Reply To: CASTing Binary Values

    The same:

    SELECT 0x00006B61+0

  • Reply To: Difference Between Lists

    Here states different:

    A.difference(B) it's the same as A-B

    https://www.geeksforgeeks.org/python-set-difference/?ref=rp

  • Reply To: @@CURSOR_ROWS -m Flag

    Magnus Ahlkvist wrote:

    This is not a correct answer. There's no -m flag. From the documentation, @@cursor_rows returns -m if the cursor is being asynchronously populated. That just means a negative value m is returned by...

  • Reply To: The SQLCMD GO

    Sorry for [semi]colon 🙂

    It's all right for error, because GO is a batch separator: @x is declared in the first batch and not in the second. It's the same as...

Viewing 15 posts - 46 through 60 (of 827 total)