Forum Replies Created

Viewing 15 posts - 3,556 through 3,570 (of 7,619 total)

  • RE: Use a case statement within a function parameter.

    You could try using a CROSS APPLY to assign the alias name, then use that alias in the SELECT clause:

    SELECT ...,
        ca1.STAGE_022_COMPLETED_DATE_IS_NULL_REV_DATE,
        [dbo].[fnc_CalcWorkDaysBetween] (ca1.STAGE_022_COMPLETED_DATE_IS_NULL_REV_DATE,...

    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 60 character string every third character with pipes

    Float doesn't have nearly 60 digits of precision, does it?

    SELECT REPLACE(CAST(FORMAT(CAST('123456789012345678901234567890123456789012345678901234567890' AS float),
    '### | ### | ### | ### | ### | ### | ### | ###...

    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: EXISTS/ ALL?

    Basically this:

    SELECT SCandidateID
    FROM dbo.CandidateSkills
    WHERE Skill IN (@ssrs_skill_param)
    GROUP BY SCandidateID
    HAVING COUNT(*) = <number_of_values_in_skill_param>

    But not sure how in SSRS to get a count of...

    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 60 character string every third character with pipes

    DataAnalyst011 - Thursday, February 8, 2018 11:31 AM

    ScottPletcher - Thursday, February 8, 2018 10:39 AM

    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: Split 60 character string every third character with pipes

    I say keep it simple unless you really need to do something more complex:

    SELECT STUFF(
        CASE WHEN SUBSTRING(column1, 1, 3) = '000'...

    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 query with this date format ?

    WHERE column_name LIKE '1[67]-Nov-2017%' /* or '%1[67]-Nov-2017%' if the column doesn't start with the day */

    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: Get difference between dates year by year

    Edit: Sorry about the formatting.  The site automatically "adjusts" (corrupts!) multiple spaces into fewer spaces.


    SELECT start_date, end_date,
      CASE WHEN start_date >= '20140101' OR...

    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: Calculating sum of days/weeks

    It's wasteful to store monthly, quarterly and yearly data in a daily table (actually, it's wasteful to store days in a year anywhere, since your year is a calendar year). ...

    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: Trigger insert

    TheSQLGuru - Tuesday, February 6, 2018 3:55 PM

    Ahh, an extra de-reference. Works for me.

    I never expect compression to be available though because...

    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: Trigger insert

    TheSQLGuru - Tuesday, February 6, 2018 1:15 PM

    ScottPletcher - Tuesday, February 6, 2018 10:03 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: Trigger insert

    TheSQLGuru - Tuesday, February 6, 2018 8:03 AM

    ScottPletcher - Monday, February 5, 2018 3:26 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: Trigger insert

    TheSQLGuru - Friday, January 26, 2018 2:08 PM

    Wait - am I seeing correctly that your sproc actually creates the log record? If...

    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 me with the SELECT statement please ?

    That's an Itzik Ben-Gap "Gaps and Islands" query.  Sorry, I don't have time now to fully flesh it out, but someone should come along shortly who can.

    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 between dates

    What is the underlying table clustered on?  If it's clus on identity, you should seriously consider clustering instead by date first, esp. if you (almost) always look up by date,...

    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: Sequential 'Alter Table' queries

    I don't get any syntax errors.  That error must be because of some text/code before or after the main code.

    But you will likely get exec errors, 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".

Viewing 15 posts - 3,556 through 3,570 (of 7,619 total)