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...

  • 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...

  • RE: Help With Not Equal (<>)

    You're welcome. Glad we could help.

  • 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...

  • 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...

  • 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'"....

  • RE: Concatenate CASE Statements

    Yup. Looks like you've probably got it.

  • 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...

  • 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...

  • 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...

  • 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...

  • 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('.')...

  • RE: Concatenate CASE Statements

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

  • 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...

  • 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...

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