Forum Replies Created

Viewing 15 posts - 3,001 through 3,015 (of 7,619 total)

  • RE: Want to Create a User and Assign Permissions in Multiple Databases at once

    You have CREATE USER in the code twice (once IF'd and once not).


    IF SUSER_ID('[Domain\IT Developers]') IS NULL
      CREATE LOGIN [Domain\IT Developers] FROM WINDOWS 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".

  • RE: Query tuning with conditional aggregation

    ChrisM@Work - Thursday, January 24, 2019 8:22 AM

    ScottPletcher - Thursday, January 24, 2019 8:12 AM

    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".

  • RE: Query tuning with conditional aggregation

    ChrisM@Work - Thursday, January 24, 2019 6:36 AM

    ScottPletcher - Tuesday, January 22, 2019 10:42 AM

    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".

  • RE: very slow select

    This is fairly typical of the results I see for a child table.  The clus index is ( parent_identity, child_identity ) and the non-clus index is ( child_identity ).

    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".

  • RE: very slow select

    Jeff Moden - Wednesday, January 23, 2019 10:39 AM

    ScottPletcher - Wednesday, January 23, 2019 10:16 AM

    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".

  • RE: very slow select

    Jeff Moden - Wednesday, January 23, 2019 9:46 AM

    ScottPletcher - Wednesday, January 23, 2019 7:53 AM

    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".

  • RE: IF field exist in multiple dbs on server

    sebekkg - Wednesday, January 23, 2019 8:14 AM

    ScottPletcher - Wednesday, January 23, 2019 6:59 AM

    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".

  • RE: very slow select

    Jeff Moden - Wednesday, January 23, 2019 7:29 AM

    ScottPletcher - Tuesday, January 22, 2019 11:27 AM

    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".

  • RE: IF field exist in multiple dbs on server


    EXEC sp_MSforeachdb '
    IF LEN(''?'') = 9 AND RIGHT(''?'', 5) = ''_prod''
    BEGIN
        USE [?];
        IF EXISTS(SELECT 1 FROM sys.columns WHERE object_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".

  • RE: very slow select

    Jeff Moden - Tuesday, January 22, 2019 10:57 AM

    ScottPletcher - Tuesday, January 22, 2019 10:02 AM

    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".

  • RE: Query tuning with conditional aggregation

    You need to either:

    Cluster the table by timestamp (if that's how you (almost) always query against the table)
    Or
    Create a non-clus index on (Timestamp) include (TagName, Value)

    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".

  • RE: very slow select

    You wouldn't typically want to cluster on status, since it tends to change.

    However, you'd almost certainly be better off clustering by PROPERTY_ID and /or SOURCE_ID in whatever order.  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".

  • RE: Performance Issue with Simple Query /Big Tables

    Quite right on the "out of memory" error.

    Overall, though, for best performance with far fewer total indexes:
    cluster the CHUB_S_CON_ADDR TABLE on ( CONTACT_ID, ROW_ID ).
    Add a...

    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".

  • RE: User Defined Function for following scnario

    No need to use resources to recompute the string every time.

    Pre-generate all the strings and store them in a permanent table.  Then just pull out the row(s) you...

    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".

  • RE: Using Cross Apply with WHERE clause

    drew.allen - Tuesday, January 15, 2019 1:36 PM

    ScottPletcher - Tuesday, January 15, 2019 12:57 PM

    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 - 3,001 through 3,015 (of 7,619 total)