Forum Replies Created

Viewing 15 posts - 3,241 through 3,255 (of 7,615 total)

  • RE: Using an ALIAS table name in a CASE statement

    SELECT in the CROSS APPLY is more flexible, in that it makes it easier to assign multiple alias names and allows for table access to be part of assigning an...

    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: Find a value immediately prior to a given date

    Somewhat confusing, but I think this may return the rows you want:


    SELECT T.*, Z.*
    FROM
    #TEMP1 T
    INNER JOIN
    [TSI].[ZATS_BROKER_FEED] Z
    ON T.Part_Num...

    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: Index - Whether or not my table should have one

    Non-clustered index(es) are almost always a waste of resources on a staging table.  

    A clustered index is much more likely to be useful, although it's obviously not guaranteed 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 execute sql agent job using wildcard?

    Lynn Pettis - Friday, July 27, 2018 10:50 AM

    ScottPletcher - Friday, July 27, 2018 10:24 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: How to execute sql agent job using wildcard?

    You don't really need a cursor for what you're described.


    DECLARE @job_name_pattern nvarchar(128)
    DECLARE @sql nvarchar(max)

    SET @job_name_pattern = 'MyJobEvery%'

    SELECT @sql = CAST((

    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: Table Redesign Question

    sgmunson - Wednesday, July 25, 2018 11:55 AM

    Have to agree with Scott on the use of an identifier (int value) for 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: Can I pull DISTINCT customers with SQL based on most recent row record only?


    set statistics io,time off

    DROP TABLE latestrecords ;
    GO
    CREATE TABLE latestrecords
    (
    Id int,
    Email varchar(200),
    Customer_FirstName varchar(200),
    Status varchar(200),
    RecordTimestamp DATETIME
    )
    GO

    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 I pull DISTINCT customers with SQL based on most recent row record only?

    drew.allen - Tuesday, July 24, 2018 12:48 PM

    I don't have time to work on this right now, but I think that 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: Can I pull DISTINCT customers with SQL based on most recent row record only?

    Jonathan AC Roberts - Tuesday, July 24, 2018 12:24 PM

    ScottPletcher - Tuesday, July 24, 2018 12:15 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".

  • RE: Can I pull DISTINCT customers with SQL based on most recent row record only?

    Lynn Pettis - Tuesday, July 24, 2018 11:56 AM

    ScottPletcher - Tuesday, July 24, 2018 11:44 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: Can I pull DISTINCT customers with SQL based on most recent row record only?

    Lynn Pettis - Tuesday, July 24, 2018 11:38 AM

    ScottPletcher - Tuesday, July 24, 2018 11:32 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: Can I pull DISTINCT customers with SQL based on most recent row record only?

    Lynn Pettis - Tuesday, July 24, 2018 11:26 AM

    Jonathan AC Roberts - Tuesday, July 24, 2018 11:02...

    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 I pull DISTINCT customers with SQL based on most recent row record only?

    Jonathan AC Roberts - Tuesday, July 24, 2018 11:02 AM

    I don't think creating and index with that column desc would help performance, at...

    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 I pull DISTINCT customers with SQL based on most recent row record only?

    The imperfect index definition is a drag on the first query, requiring a sort of all rows.  Correcting the index definition:

    DROP INDEX IX_latestrecords_1 ON latestrecords;
    CREATE UNIQUE INDEX...

    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: Table Redesign Question

    Not enough details to get specific, but in very general terms, I would likely go with a new option.

    Keep the existing tables to do the current logging, 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".

Viewing 15 posts - 3,241 through 3,255 (of 7,615 total)