Forum Replies Created

Viewing 15 posts - 6,076 through 6,090 (of 7,613 total)

  • RE: Need to return values with multiple entries only

    If you just want the total hours, you don't need to return all the rows at all, simply total the time differences. This is very easy if there 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: Search Logic Fails

    In the Stores table, use a function to compute a persisted column that is the store name with all non-alphabetic characters stripped. Do the comparisons on that column, 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: Select * if null passed else by INT

    To make sure you don't get a really poor plan, force SQL to recompile the query:

    SELECT p.ProjectID, p.ProjectName, p.ProjectDescription

    FROM tbl_Projects p

    WHERE

    p.ProjectID = @ProjectNumber

    OPTION(RECOMPILE)

    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: Fastest way to delete from a large table

    What is the clustering key on the table?

    Can you determine a range of clustering key values for the rows you want to DELETE?

    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: Select Large Data From Multiple tables

    Full-text indexing would likely help you the most here.

    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: trying to figure out join to find all records from one table that do not exist in other table, grouped by a certain column

    I don't think you actually need to go thru all those gyrations; instead, try this:

    ;WITH allstores(storeid, doc, article) AS(

    SELECT 'ALL', '0010', '001' UNION ALL

    ...

    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: Is there a better way to constuct this reverse Wildcard Select statement

    Looks reasonable to me. I don't see a "better" way.

    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: Combine to tables to display iteratively

    SELECT

    ProjectID,

    Project_Name AS [Project_Name|UpdateDescription],

    CONVERT(varchar(10), Start_date, 120) AS Start_date,

    ProjectDescription

    FROM #tbl_projects

    UNION ALL

    SELECT

    ...

    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: Max Value even for negative numbers

    Since it's only three values, maybe this:

    ...

    ,isnull(cast(CASE ca1.COMM_max WHEN 1 THEN COMM1 WHEN 2 THEN COMM2 ELSE COMM3 END*QTY*1.8 as numeric(6,2)),0) as RATE

    FROM dbo.yourtablename

    CROSS APPLY (

    SELECT...

    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: Enabling CDC for hundreds of databases on one instance, do or do not?

    MysteryJimbo (5/13/2014)


    ScottPletcher (5/13/2014)


    You have broad control of the frequency of cdc scan processing, and can even customize it if you want. I wouldn't ever want to risk the never-ending...

    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: Enabling CDC for hundreds of databases on one instance, do or do not?

    You have broad control of the frequency of cdc scan processing, and can even customize it if you want. I wouldn't ever want to risk the never-ending maintenance of...

    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: Question re Check Contraints

    You can't use a standard CHECK constraint, as all values must be available on a single row for that.

    You could easily use an AFTER DELETE, INSERT[, UPDATE ] trigger if...

    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: Enabling CDC for hundreds of databases on one instance, do or do not?

    CDC should perform far better than hand-written triggers on all those tables.

    Make sure you have sufficient pre-allocated log space to hold the changes until CDC can process them all.

    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: Can anyone clarify a PATINDEX phrase?

    It's testing to make sure that @Num contains only "0"-"9"s and/or "-"s.

    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: created a index rebuild job want to understand what happens when it runs

    Jeff Moden (5/12/2014)


    ScottPletcher (5/9/2014)


    Jeff Moden (5/7/2014)

    On the SORT IN TEMPDB thing... It'll only affect TEMPDB by 10 or 20% of what the largest index is.

    I don't understand the rationale...

    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 - 6,076 through 6,090 (of 7,613 total)