Forum Replies Created

Viewing 15 posts - 14,416 through 14,430 (of 14,953 total)

  • RE: Choosing between a View and Table-valued function

    Jeff Moden (4/1/2008)


    GSquared (4/1/2008)


    But what advantage would this gain in real-world use? It's more work to set up, slightly more work to maintain, and I'm not clear on the...

    - 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: HOw is the best way to build multiple filters?

    And for a little more housecleaning, I'd replace:

    CREATE Table #CertType (

    Type VARCHAR(50),

    XID INT

    )

    INSERT iNTO #CertType

    SELECT DISTINCT Type, XID...

    - 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: HOw is the best way to build multiple filters?

    Replace:

    and 1 =

    case

    when @CertType is null then 1

    else

    case

    ...

    - 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: HOw is the best way to build multiple filters?

    Since you've already hard-coded all of this part:

    Create TABLE #CertStatus (

    StatusID INT,

    StatusDesc CHAR(20)

    )

    INSERT INTO...

    - 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: Find Only Yesterday's Orders?

    Change:

    ProcessDate BETWEEN @yesterday AND @today

    to:

    ProcessDate >=@yesterday AND processdate < @today

    Otherwise, you'll run the risk of getting data from midnight last night (technically today) in the mix.

    - 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: What is the correct syntax for *= in 2005?

    That one's Left Outer (as previously noted).

    != is not equal.

    - 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: trigger not called for each record?

    Okay. Now I can follow what's going on.

    You have a trigger that uses a cursor to call a proc that uses a cursor to call another proc that calls...

    - 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: Choosing between a View and Table-valued function

    Thinking about another post on this same thread, there is another solution, which would be to have every proc that needs the hierarchy create a temp table around a specific...

    - 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: Choosing between a View and Table-valued function

    TheSQLGuru (4/1/2008)


    Here is my take on reusability:

    1) most code doesn't actually GET reused because a) all devs don't know about it, b) devs don't bother checking to see if their...

    - 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: Choosing between a View and Table-valued function

    TheSQLGuru (3/31/2008)


    GSquared (3/31/2008)


    I've used UDFs in cases where the select logic was so insanely complex that a single query just couldn't do it (which leaves out views) and it needed...

    - 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: trigger not called for each record?

    Andre, I must be missing something. Your updateSettings proc doesn't seem to actually do anything except call itself recursively. I don't see any update/insert/delete commands in it. ...

    - 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: Query won't work (cursors... I know...)

    You're welcome.

    Without the temp table, you'd quickly run into the problem of too many selects, which Management Studio will bomb out on.

    Of course, it's a really bad idea to run...

    - 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: I need to add the last day of the month to a result from a column containing only year and month

    select dateadd(month, 1, cast(enddate + '01' as datetime)) - 1

    from dbo.sasimp

    Should give you what you need. If it gives you an error about converting enddate to varchar, try this:

    select...

    - 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: Query won't work (cursors... I know...)

    I modified the script as follows:

    create table #Test (

    DB varchar(100),

    TableName varchar(100),

    RowQty int)

    DECLARE @dbname VARCHAR(50)

    DECLARE @string VARCHAR(2500)

    DECLARE db_cursor CURSOR

    FOR SELECT name

    ...

    - 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: Using Count

    I'm going to hazard a guess that [Date] and/or [DateImport] are datetime columns with the date AND the time in them. In which case, your Group By is almost...

    - 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 - 14,416 through 14,430 (of 14,953 total)