Forum Replies Created

Viewing 15 posts - 1,696 through 1,710 (of 7,613 total)

  • Reply To: Help with a query

    First let's correct the PK.  Then the code for the proc.

    ALTER TABLE [dbo].[Contracte] DROP CONSTRAINT [PK_Contracte];
    ALTER TABLE [dbo].[Contracte] ADD CONSTRAINT [PK_Contracte]
    PRIMARY KEY...

    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: Top 1 makes very fast query into very slow query

    If it could ever have more than one, then it needs to be a JOIN, just like you have it.

    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: Top 1 makes very fast query into very slow query

    Yeah, seems like a bug in SQL optimizer.  I'd make sure SQL didn't use a LOOP join (gack!) for the two main tables.  I think the hint will also force...

    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: Entry point in sysdatabases

    You're welcome!

    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 troubleshoot PK Constraint violation

    The source table, DBSource.dbo.Contacts, must have duplicate entries for the same ContactID.

    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: What is the best way to see Deadlocks info and take advantage of analyzing it?

    Yes, a standard Agent Alert, like below, but you need to change <instance name> to your actual instance name and the job id to your actual job id:

    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: What is the best way to see Deadlocks info and take advantage of analyzing it?

    Overhead.  The default health trace contains deadlock info, although I prefer to create my own extended event specifically for deadlocks.

    I have an alert that triggers a job when a deadlock...

    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 Query issues - different conditions in the SELECT list

    There is a T-SQL forum.  This type of q would generally go there.  But not a real problem.  Try the code below:

    SELECT pf.Name, 
    ...

    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: Huge size of Reporting tables

    Sergiy wrote:

    S_Kumar_S wrote:

    For choice of clustered index columns, I am confident that they are correct. They are int or bigint columns and are very frequently used in many queries.

    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: SQL Write-Ahead Logging

    (1) Yes.

    (2) It means to any recoverable resource, that is, any resource affected by COMMIT / ROLLBACK.

    (3) Data in memory (in a buffer) that is forcibly written to disk is...

    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 Write-Ahead Logging

    First, need to number these qs:

    SQLSACT wrote:

    (1) With WAL - Any modifications are written to the transaction log before they're written to the data files (mdf). Is this correct?

    Most articles...

    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: Entry point in sysdatabases

    I'm not getting any syntax errors on:

    ALTER DATABASE [IBMStemplate] SET ANSI_NULL_DEFAULT OFF

    Not sure what that's about.

    Btw, I just noticed that you're growing the log file by 10%.  NEVER use %,...

    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: Page/Row DEcompression, when does it occur?

    https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008/dd894051(v=sql.100)

    "

    Compressed pages are persisted as compressed on disk and stay compressed when read into memory. Data is decompressed (not the entire page, but only the data values of interest) when...

    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: Huge size of Reporting tables

    S_Kumar_S wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    S_Kumar_S wrote:

    We have dedicated Sr. People for optimization and they have been doing it for more than a decade for some good clients. So we trust their...

    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: Entry point in sysdatabases

    SQL often "parses ahead" for errors.  SQL detects that the db doesn't yet exist and so can issue errors.

    I usually use dynamic SQL to get around these types of errors:

    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 - 1,696 through 1,710 (of 7,613 total)