Forum Replies Created

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

  • RE: Need to sum up a team's win totals in last 5 games

    Give this query a try: I couldn't test it as I don't have data:

    SELECT team,sum(ats) as W,sum(atsloss) as L,sum(O) as Ov, sum(U) as Un,

    ...

    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: Pull string between a certain string and a tab (char(9))

    Here's some sample code, in case it helps:

    DECLARE @text_column varchar(max)

    SET @text_column =

    'I need to pull whatever the string is in a text column that occurs after the word Requestor:...

    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: @@ROWCOUNT not working if stored procedure has temp table in it

    If you want a specific value, return it from the proc, don't rely on the "last" statement in the proc yielding the correct @@ROWCOUNT: how is someone later supposed 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: How to do CASE WHEN THEN CASE

    Hugo Kornelis (1/30/2016)


    Though you have your answer, I'd like to add that in many cases it is not needed to nest CASE expression. For instance, this should work for 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: Datetime conversion

    Since the final date format is "self delimiting", you don't have to add spaces in the result. But I would adjust the code to allow the day to be...

    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/27/2016)


    ScottPletcher (1/27/2016)


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

    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.

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

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