Forum Replies Created

Viewing 15 posts - 2,971 through 2,985 (of 7,613 total)

  • RE: sp_stop_job not stopping job, but "right click" and stop does

    If you're going to use a name, explicitly specify it as a job name:

    exec msdb.dbo.sp_stop_job @job_name = @jobname ;

    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: Sort already comma separated list

    jcelko212 32090 - Tuesday, February 5, 2019 2:53 PM

    Jeff Moden - Monday, February 4, 2019 2:28 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: Database Growth Percentage and Size

    The column "Totalspace" doesn't exist any more: the columns in the inner query are "minval" and "maxval".

    So, something like:

    select
      databasename, minval, maxval,
      ...

    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: Sort already comma separated list

    jcelko212 32090 - Tuesday, February 5, 2019 12:57 PM

    >> It's stored as numeric because it's more efficient, both in terms of size...

    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: Case in a where clause?

    CASE must evaluate to a single value.  For this, you need to use "standard" WHERE clause and/ors:

    WHERE([Admission Date] IS NOT NULL)
    and
    (@Parameter = 'A' and [Close...

    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: findeing matching names from one database to another

    If I understand correctly, this is what you want:


    SELECT
        BCC.FirstName + ' ' + BCC.Lastname AS Matching_Name
    FROM (
        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: Sort already comma separated list

    jcelko212 32090 - Monday, February 4, 2019 11:16 AM

    Jeff Moden - Sunday, February 3, 2019 8:08 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: Split column values using delimiter and insert them into referenced table

    HappyGeek - Sunday, February 3, 2019 2:04 AM

    Since this is SQL 2016 you could achieve the same using the string_split function. I...

    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: CASE with LEN Evaluation

    A shorter alternative:


    SELECT [Col1],
        CASE
            WHEN [Col1] = '0' OR [Col1] = '200' THEN '99991231'
       ...

    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 calculate income tax for a slab based taxation system?

    I'd strongly urge you to make this table driven rather than hard-coding any of this.  If we know anything, it's that taxes always go up!


    DROP...

    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: Two selects, a column is invalid in the the second Select,but not first

    Might be better to just add all the calc'd columns to the underlying table, so that all queries automatically can use those columns:

    ...
    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: updating records from one table using SELECT on another table

    That format also makes it very convenient to run a SELECT test before the UPDATE, like so:


    UPDATE p
    SET p.statusid = c.statusid
    --SELECT /*TOP...

    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: Pass date input parameter as float data type

    Does it store the result back into a datetime variable?  If so, using float to strip the time is not a problem.

    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: Sort already comma separated list

    Luis Cazares - Wednesday, January 30, 2019 11:41 AM

    ScottPletcher - Wednesday, January 30, 2019 11:38 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: Sort already comma separated list

    This topic comes up so much, I think MS should "fudge" a little on the relational model and create a type of "char array".  Then include not just selection against...

    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 - 2,971 through 2,985 (of 7,613 total)