Forum Replies Created

Viewing 15 posts - 406 through 420 (of 14,953 total)

  • RE: Dynamic SQL

    SQL_Kills (12/11/2012)


    Sorry what is the above meant to be saying to me?

    One of the common flaws in dynamic SQL is that it allows what's called "SQL Injection". Simple version...

    - 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: CASE statement in WHERE clause

    In that case, try the version I posted, with the OR clause in it. Case will do the same thing, but can result in even more complex execution plans...

    - 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: Help With Not Equal (<>)

    You're welcome. Glad we could help.

    - 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 a Tally table the best solution?

    I'd be inclined to create an indexed view that breaks the data down for you, and then query that.

    Alternatively, a set of computed columns in the table itself.

    Computed columns version:

    USE...

    - 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: Select GROUP BY QUERY

    I can't tell what criteria you are using to determine which rows to return in your query.

    Is it the last (per EntryDate) for each quiz? The first? Something...

    - 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: Help With Not Equal (<>)

    Get rid of the "o.name <> 'GLUCOSE'" part. It's the primary problem here.

    Change the "o.entered_date <> '2012-12-11 06:35:55.120'" to a simple less-than. Should be "o.entered_date < '2012-12-11 06:35:55.120'"....

    - 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: Concatenate CASE Statements

    Yup. Looks like you've probably got 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: XML Shredding

    You're welcome. Glad we could help.

    I just saw arthurolcot's post.

    If the log entries are always singular, that will work. I used the nodes() function in my solution in...

    - 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: Type A, B, or C

    jbnv (12/11/2012)


    Jeff Moden (12/11/2012)


    jbnv (12/11/2012)


    And to say that assessing someone's personality is "discrimination" and should be outlawed is an insult both to the researchers who developed these assessments and people...

    - 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 was asked in a interview

    It is a good question.

    I'd hope for answers along the lines of, "There are several options, depending on the server settings (including whether dbmail has been enabled or not), 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: CASE statement in WHERE clause

    Guras (12/11/2012)


    I was thinking of writing two sub proc based on the finclass value. There will be a wrapper sp that takes the finclass values and based on that I...

    - 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: XML Shredding

    Here's a simple version:

    DECLARE @XML XML = '

    <server name="Server1">

    <log>

    <logItem type="LogDate">

    <value string="2012/12/15" />

    </logItem>

    <logItem type="error">

    <value string="File not found" />

    </logItem>

    <logItem type="source">

    <value string="Dir/SubDir/SomeFile" />

    </logItem>

    </log>

    </server>';

    SELECT LogItem.value('(/logItem/value/@string)[1]', 'varchar(max)') AS ErrorString

    FROM (SELECT L.Item.query('.')...

    - 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: Concatenate CASE Statements

    P.S.: Love the screen name you picked!

    - 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: Concatenate CASE Statements

    If you're using SQL 2008 (as per the forum you posted in), then yes, there's a simple solution. Cast the columns to NVarchar(max). That will work in any...

    - 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: CASE statement in WHERE clause

    TheSQLGuru (12/11/2012)


    GSquared (12/10/2012)


    Like this:

    WHERE (@finclass = 1 AND p.finclass = @FinclassCategory OR @finclass != 1)

    AND P.HOSPITAL = @HOSPITAL

    This is going to get you a BAD cached plan. No matter...

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