Forum Replies Created

Viewing 15 posts - 3,016 through 3,030 (of 7,613 total)

  • RE: Select convert to 2 decimal places, comma, right aligned


    select
        right(space(12)+convert(varchar(20),cast([User_Info_Currency_1] as money),1), 12) as [Replacement Cost]
    from (
    values(
    523.88000),(
    60689.76000),(
    48860.26000),(
    77239.26000),(
    132227.26000),(
    65668.18000),(
    71523.34000)
    ) as EQSA0345(User_Info_Currency_1)

    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 Optimization

    Reforrmat  the SSICat data and not the ep data, since there should be far fewer SSICat rows.

    How is the EncounterProc table clustered?

    Hopefully you don't actually need...

    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 this join?


    SELECT
    b.Period AS B_Period,
    a1.Period AS A_period,
    a1.SomeValue
    FROM #TableB b
    OUTER APPLY (
        SELECT TOP (1) a.*
        FROM #TableA 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: Query Performance

    Jeff Moden - Wednesday, January 2, 2019 9:46 AM

    ScottPletcher - Wednesday, January 2, 2019 8:26 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: Query Performance

    Cluster the [SearchSuggest_QGram_tbl] on [nameCacheId] rather than on gram.

    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: Validate date stored as a string as a complete, valid date

    Jeff Moden - Monday, December 24, 2018 10:41 AM

    Scott In Sydney - Thursday, December 20, 2018...

    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: Validate date stored as a string as a complete, valid date


    SELECT s
        s2
        ,TRY_CAST(s2 AS DATE) AS ScottPDate
    FROM @t
    CROSS APPLY (
        SELECT LTRIM(RTRIM(s)) AS s1
    ) AS ca1
    CROSS...

    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: Implementing a trigger on a status change/insert rec to update a flag

    I'd add the standard "nocount" setting, but other than that it looks good:


    alter trigger trg_up_in_changeflag
    on example_table
    after update, insert

    as

    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: Error: Cannot insert duplicate key row in... a non-unique index?!

    Eric M Russell - Tuesday, December 18, 2018 3:37 PM

    After examining Query Store, I have determined the following update statement is 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: Error: Cannot insert duplicate key row in... a non-unique index?!

    Eric M Russell - Tuesday, December 18, 2018 3:20 PM

    Jeffrey Williams 3188 - Tuesday, December 18, 2018...

    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: Validate date stored as a string as a complete, valid date

    If you're on SQL 2016 (or even SQL 2012), just use TRY_CAST:


    SELECT s
    ,TRY_CAST(s AS date) AS MyDate
    FROM @t

    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: Error: Cannot insert duplicate key row in... a non-unique index?!

    Eric M Russell - Monday, December 17, 2018 12:50 PM

    I'm not on the ETL team, so I can't vouch for the specifics...

    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: Help Using CASE instead of IF/. ELSE

    Phil Parkin - Monday, December 17, 2018 12:36 PM

    It may be worth considering putting a computed LocationCode column on your table. 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: Error: Cannot insert duplicate key row in... a non-unique index?!

    Eric M Russell - Monday, December 17, 2018 12:25 PM

    ScottPletcher - Monday, December 17, 2018 12:11 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: Help Using CASE instead of IF/. ELSE

    Assuming location is "01", "02", etc., when passed in, then:


    Select *
    from table_1
    Where
    ID = @ID
    AND Printing = 0
    AND Salary =...

    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,016 through 3,030 (of 7,613 total)