Forum Replies Created

Viewing 15 posts - 4,456 through 4,470 (of 7,613 total)

  • RE: Having my query use less resources.

    I don't have any sample data, so I can't possibly test the code first. If I had data, I would have tested it first.

    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: Multiple queries in the same stored procedure

    Jeff Moden (1/26/2016)


    Manic Star (1/26/2016)


    So we had a development. An SQL MVP at days of .Net told our devs that their beloved UberQueries were ok since the QA cached 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: Multiple queries in the same stored procedure

    Luis Cazares (1/26/2016)


    Manic Star (1/26/2016)


    So we had a development. An SQL MVP at days of .Net told our devs that their beloved UberQueries were ok since the QA cached 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: Need Create View Script for all tables

    I'd strongly urge you to avoid the INFORMATION_SCHEMA views. Instead, stick to the sys. views.

    Not only are I_S views deficient in newer columns vs. the system tables, they 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: TSQL SYNTAX HELP PLEASE!!!!

    Here's the clear version of the code:

    IF (@phrase_type IS NULL OR @phrase_type = ' ')

    Instead, the original code uses:

    IF (ISNULL(@phrase_type, ' ') = ' ')

    The ISNULL(<value1>, <value2>) will replace 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: Database in full recovery?

    The consultant indicated they usually advice to take a full backup at night and an incremental backup during lunch time (kicking everybody out of the system).

    I guess this...

    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: Having my query use less resources.

    If all you need is a count, don't insert rows into a table variable, just get the count directly:

    SELECT@QCount = COUNT(*)

    FROMtbl_Q_Tags_Map M

    JOINtbl_Q Q ON M.QID=Q.QID

    WHERETagID IN (SELECT Token FROM @TokenTable)...

    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: Date Function

    Sergiy (1/25/2016)


    ScottPletcher (1/25/2016)


    Sergiy (1/25/2016)


    MMartin1 (1/25/2016)


    No, since this particular statement is vague the best we can do is start him off with some basics to try and get more information. This...

    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: Date Function

    Sergiy (1/25/2016)


    MMartin1 (1/25/2016)


    No, since this particular statement is vague the best we can do is start him off with some basics to try and get more information. This is not...

    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: How to figure out whether data is selected from dirty pages?

    GilaMonster (1/22/2016)


    SQL Guy 1 (1/22/2016)


    They agreed with second option, but with condition that the "dirty" records will be marked somehow in the report. So they conditionally accept it.

    Nice idea,...

    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: referencing same column in same table but coulum has different values

    My best guess at the code, known as a "cross tab" query, is below. You're not using anything from table B in the code. Are these really 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: How to figure out whether data is selected from dirty pages?

    Is the ETL process working in such a way that it gets a table lock? If so, you may be able to remove the table lock and accept that...

    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: Date Function

    SumonB (1/20/2016)


    What if today's date is 5th January' 2016.

    Will it show the start date as 21st December'2015 and End date as 5th January'2016

    Yes ... and here's the proof:

    Declare @StartDate Datetime,

    ...

    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: Date Function

    If you always need exactly 15 days, just do this:

    Declare @StartDate Datetime,

    @EndDate Datetime

    set @EndDate=DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0) --strip time from date

    set @StartDate = DATEADD(DAY, -15,...

    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 to calculate nth day of nth month

    Orlando Colamatteo (1/20/2016)


    ScottPletcher (1/20/2016)


    Orlando Colamatteo (1/19/2016)


    ScottPletcher (1/19/2016)


    Of course that code doesn't specify the date key, so it will do a full table scan. Again, vastly too much overhead when two...

    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 - 4,456 through 4,470 (of 7,613 total)