Forum Replies Created

Viewing 15 posts - 2,161 through 2,175 (of 7,619 total)

  • Reply To: MERGE with (SERIALIZABLE) deadlocks occasionally

    giga123 wrote:

    >>Use INSERT instead of MERGE in the second statement.

    How would I then handle duplicates? I don't want to insert a duplicate record if there already is one that matches...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Daily Counts by Month based on Start/End date

    Since you only want monthly totals, I don't see any reason for the overhead to create a row for every single day; instead, you really only need a row for...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: MERGE with (SERIALIZABLE) deadlocks occasionally

    The SERIALIZABLE would cause higher levels of locks and cause them to be held longer.

    Use INSERT instead of MERGE in the second statement.

    Personally I'd use an UPDATE then INSERT on...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Sequence not always returning number

    I guess the sequence must be called so many times that you're running out of values for an int.

    Maybe use a bigint for the sequence?

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: How to pull only account ids that have multiple adddresses?

    I can't test these since you didn't provide directly usable test data:

    --if you need only the acct_ids
    SELECT acct_id, COUNT(*) OVER() AS total_accts
    FROM my_table
    GROUP BY acct_id
    HAVING MIN(street +...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: count occurrences/frequency in a multiple value column

    As noted by Brian, your table design is completely wrong.  You've then had to corrupt the data to fit it into the bad table structure.

    For example, the language is "English". ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Upgrade SQL 2017 to 2019

    I think there is one way you can try the upgrade path.

    IF your san/disk/software allows you to snapshot a given point-in-time on disk, and accurately restore everything on disk (including...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: SQL input parameters are defaulting to nvarchar causing full table scans

    OP = "original poster", i.e., the person that originally asked the q (or, rarely used and only by some people, "original post")

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Upgrade SQL 2017 to 2019

    Anders Hansen wrote:

    The actual database and logfiles should preferably be kept on same drives as they are now.

    The most simple approach I can come up with is:

    • Detach the database in...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: SQL input parameters are defaulting to nvarchar causing full table scans

    frederico_fonseca wrote:

    ScottPletcher wrote:

    I think you're correct, you should do this for all tables.  No sense wasting resources scanning a 900-row table either.  Of course that 900 rows could be far...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: SQL input parameters are defaulting to nvarchar causing full table scans

    I think you're correct, you should do this for all tables.  No sense wasting resources scanning a 900-row table either.  Of course that 900 rows could be far larger than...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Is Index Fragmentation Still Relevant in a Cloud Base/Virtual SQL Server Setup

    Hmm, I wouldn't think there'd be a direct money charge just from having to reread something into RAM.  Then again, that could change by vendor I guess (we use MS).

    But...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: SQL - How to compare data of a column while iterating row by row and insert new

     

    /*INSERT INTO dbo.input_Main_data ( ... )*/
    SELECT new_rows.*
    FROM dbo.input_Main_data iMd1
    CROSS APPLY (
    SELECT TOP (1) *
    FROM dbo.input_Main_data iMd2
    ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Can we know the detailed information of a table ?

    Grant Fritchey wrote:

    892717952 wrote:

    ScottPletcher wrote:

    SQL row/page compression is typically extremely helpful to reduce disk space.  Before SQL 2016, I believe you must have Enterprise Edition for it to be available.

    Yes, I...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Is Index Fragmentation Still Relevant in a Cloud Base/Virtual SQL Server Setup

    I see the big issue as one of less RAM.  I suspect the max ram you receive will be far less than what you'd get in an on-premises db.

    When fragmentation...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 15 posts - 2,161 through 2,175 (of 7,619 total)