Forum Replies Created

Viewing 15 posts - 1,651 through 1,665 (of 7,613 total)

  • Reply To: Finding columns with null values

    Did you run the SELECT by itself to make sure you get results from that?

    SELECT c.name 
    FROM sys.tables t
    JOIN sys.columns c ON t.object_id = c.object_id
    WHERE t.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: Category Entry and Exit Dates per ID

    I think this is a form of Gaps and Islands (term coined by Itzik Ben-Gan?  maybe?).  It's rather traditional in G&I to use the name "grp", so I stuck with...

    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: Using CASE Statement with $Action in Output Clause in Merge

    Yes, only 1 OUTPUT clause.  My best suggestion is to use CASE for every column.  You can generate the CASE statements from the table definition so you don't have to...

    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: Simple SQL query

    Just now noticed the Postgre sql qualification.  I answered for SQL Server; code may or may not work on Postgre.

    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: Simple SQL query

    For (1):

    SELECT GUEST.GUESTID 
    FROM GUEST
    WHERE GUEST.GUESTNAME='John %' /*space added because don't want name 'Johnathan' or 'Johnny'*/ AND
    EXISTS(SELECT 1 FROM BOOKING WHERE BOOKING.GUESTID=GUEST.GUESTID AND...

    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: extract name to 3 single columns

    This ends up being a very complex task.  There are a number of threads about it on this site.

    Here's a doozy (from history): Claus Philipp Maria Justinian Schenk Graf von...

    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: Query select.

    An alternative:

    SELECT
    Field0,
    CASE WHEN Field1_with_Field4 <> '' THEN Field1_with_Field4 ELSE Field1_without_Field4 END AS Field1,
    CASE WHEN Field1_with_Field4...

    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: Grant Execute on ALL procs in a Database

    USE [DB_XYZ];

    GRANT EXEC TO [MyDomain\User_1]

    That includes system procs, of course.  If you prefer, you can do this:

    GRANT EXEC ON SCHEMA::dbo TO [MyDomain\User_1]

    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: Transaction log and updates on large tables

    Jeff Moden wrote:

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    ScottPletcher wrote:

    (3) SQL does that itself, so that's only a very minor consideration.

    I might be misinterpreting what you're saying above 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: Profiler Trace

    I've started creating a separate deadlock extended event myself.

    Here's an example of how to create a deadlock ext event.  Naturally your WITH options may vary.  You can then use SSMS...

    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: Transaction log and updates on large tables

    Sergiy wrote:

    Data pages make up a clustering key. No data page exists outside a clustering key. if any data in a table with a clustering key is updated then...

    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: Transaction log and updates on large tables

    Jeff Moden wrote:

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    ScottPletcher wrote:

    (3) SQL does that itself, so that's only a very minor consideration.

    I might be misinterpreting what you're saying above 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: Transaction log and updates on large tables

    ScottPletcher wrote:

    The Dixie Flatline wrote:

    Paul is certainly a worthwhile authority.   I will study his article later.   I did notice this quote, which was emphasized:

    A clustered table will always produce full...

    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: Transaction log and updates on large tables

    The Dixie Flatline wrote:

    Paul is certainly a worthwhile authority.   I will study his article later.   I did notice this quote, which was emphasized:

    A clustered table will always produce full logging and...

    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: Transaction log and updates on large tables

    The Dixie Flatline wrote:

    ScottPletcher wrote:

    The data still has to be read -- how else would SQL know that the proposed new value was the same as the value in the...

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