Forum Replies Created

Viewing 15 posts - 5,266 through 5,280 (of 7,613 total)

  • RE: Need help with an indexed view

    You don't really need a separate indexed view if that's the full query. You could instead add a flag to the dm_document table of whether a matching row existing...

    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: [sys].[procedures]

    In effect, yes, you could add a "signature" using extended properties. It could be anything you want, just an entry to show that you created the proc.

    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: Need help on Data (page) compression and Database size

    Roughly normal, yes. The rebuild process requires additional disk space.

    But, after the rebuild, more of that 102G is unallocated and could, theoretically, be released to disk by shrinking 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".

  • RE: Must declare the scalar variable "blah"

    No, but you must alias it so SQL can recognize the difference between a scalar variable one a table. I think it's a parsing issue if you don't 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".

  • RE: Need help on Data (page) compression and Database size

    Not automatically. When pages are freed from a table, they are basically as marked as "not in use" within that db, but they remain in that db and are...

    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: Nonclustered Indexes on Bit Flags

    You'd want the flag column(s) to key the index, not column1. Start with whichever flag is more selective. So, either: (flag1, flag2) or (flag2, flag1).

    But, as Grant noted,...

    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: CASE WHEN IN string spaces problem

    Maybe it's a case-sensitive db and the literal's case doesn't match the case stored in the table??

    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: Variables, Sargability, and Indexes

    I don't see a clustered index on the table (but maybe I just missed it).

    If you most often / always query the table based on YrMo, cluster the table 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".

  • RE: SQL Script help - Records that do not have a completed date

    Something like below I guess. I can't test it (and thus also can't review the query plan to check potential performance) because I don't have data with which 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".

  • RE: Query running very slow

    pwalter83 (3/25/2015)


    ScottPletcher (3/25/2015)


    You should get rid of the DISTINCT in the subquery; since you're GROUPing on BL_ID, you don't need it anyway.

    Otherwise it's difficult to re-write because there are no...

    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: Elegant way for returning all results when subquery returns no results?

    If I understand the query correctly, I think this will do it:

    DECLARE @SearchId INT = 100

    SELECT Customer.*

    FROM Customer

    WHERE

    NOT EXISTS(

    ...

    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 running very slow

    You should get rid of the DISTINCT in the subquery; since you're GROUPing on BL_ID, you don't need it anyway.

    Otherwise it's difficult to re-write because there are no aliases 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".

  • RE: Want to return character(s) after a dash (-)

    You can specify a longer length on the SUBSTRING and it won't hurt anything, so you skip calculating the length; for example:

    SELECT SUBSTRING(string_value, CHARINDEX('-', string_value) + 1, 100)

    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: Good, free, simple database modelling tools

    CA ERwin has a free tool now, although that version does limit the number of objects. The full ERwin is a fantastic modeling tool (my favorite of the many...

    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: Design Question to minimize blocking

    The READPAST hint is very helpful in those types of situations. I believed it was designed to help handle these types of "queue assignment" queries.

    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 - 5,266 through 5,280 (of 7,613 total)