Forum Replies Created

Viewing 15 posts - 1,606 through 1,620 (of 14,953 total)

  • RE: The recursive part of a CTE do not allow aggregate functions

    yousui (4/25/2012)


    Hello GSquared, if this can't be implemented by CTE. Do you have a way to do this?

    Thanks.

    I'm accustomed to doing this via VB.NET CLR functions in SQL Server 2005...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: replace function

    Lynn Pettis (4/25/2012)


    Does anyone see anything wrong with this where clause?

    Where PortfolioBaseCode = Replace(@Portfolios,'@','') as reportheading1

    "as" then column alias in a Where clause.

    Which won't parse.

    Which means it's not the actual...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: The recursive part of a CTE do not allow aggregate functions

    Because it's not actually a hierarchy, a recursive CTE isn't the right way to do this. You'll just frustrate yourself with that approach to it.

    Recursive CTEs are really only...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: replace function

    Lynn Pettis (4/25/2012)


    GSquared (4/25/2012)


    Then the error is somewhere else in your code. Post the right part.

    Gus, walk away. You will never get a full answer to any of...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: replace function

    Then there's something else wrong.

    If you're getting that error message, some piece of your query is trying to convert a string (NVarchar) to a floating point value, and it's incompatible....

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Performance Measuring Tool

    I currently use Confio Ignite to do that. I'm doing some testing on Quest Performance Analyzer to see if it works better for what I need on that.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Column in a case statement is not working

    m.eissa85 (4/25/2012)


    I don't think that case work in where clause, But I didn't check it. You can rewrite the condition as following:

    My query is

    DECLARE @var AS VARCHAR(4)

    SET @var =...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: replace function

    Then the error is somewhere else in your code. Post the right part.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Sql Query to find invalid SSN Numbers

    Sean Lange (4/25/2012)


    It doesn't check for SSNs issued from Connecticut for people born and raised in Hawaii.

    ROFL!!!! 😛

    Yeah, I couldn't resist. Or, more honestly, I could have, but chose...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: replace function

    Either column "PortfolioBaseCode" is datatype Float, or variable "@Portfolios" is. Can't tell which one from your post, but it's one or both.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Sql Query to find invalid SSN Numbers

    Something like this will work:

    SELECT *

    FROM ( VALUES ( '123-45-6789'), ( '123-54-6789'), ( '923-00-1234'), ( '123-00-1234'), ( '123-45-0000'),

    (...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Remove trailing space from a field

    You might still have problems with that function.

    If, for example, you have a double-space inside the string, instead of just at the end of it, then you won't end up...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Column in a case statement is not working

    You've misunderstood what a Case statement is for in T-SQL. It's a common confusion. What you wrote looks like Visual Basic or some language related to that.

    In SQL,...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Odd behaviour in a trigger

    The inserted and deleted tables behave a little differently than regular tables. No indexes, for one thing. No stats. So querying them can be a performance issue....

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Is Cursor Really Not Good?

    The problem rows have DIDOC# values. Your subquery (the Cross Apply query) requires that they be the same as per the first item in the Where clause. You...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 15 posts - 1,606 through 1,620 (of 14,953 total)