Forum Replies Created

Viewing 15 posts - 1,366 through 1,380 (of 14,953 total)

  • RE: trimming a text string

    Here's something a bit flexible for this kind of thing:

    DECLARE @String VARCHAR(1000) = 'Bev\Soda\The Dew',

    @Delim CHAR(1) = '\',

    @Elements INT = 0,

    ...

  • RE: How do i limit the number of records using a 'TOP' without changing the max record count ?

    Instead of a CTE, insert into a temp table, and query the count(*) and top (4000) from that.

  • RE: XML

    Generally, I've been lazy and pulled the raw XML into a staging table with an XML datatype column, then used XQuery to shred the XML into relational format. I've...

  • RE: Help with getting top 5 forum posts

    Given this table structure:

    PostID | ParentPostID | Subject | Body | CreatedDate | ThreadID

    Do you have any data where ParentPostID goes up to a row that also has a parent?...

  • RE: Tuning People?

    "Tuning" people and organizations is easy. You just have to know what you're doing. Most don't. A few are the equivalent of "he's good with computers, let's...

  • RE: Trying to find the compile time for a plan

    Something like this:

    ;

    WITH XMLNAMESPACES (DEFAULT 'http://schemas.microsoft.com/sqlserver/2004/07/showplan')

    SELECT * ,

    query_plan.value('(/ShowPlanXML/BatchSequence/Batch/Statements/StmtSimple/QueryPlan/@CompileTime)[1]','int')

    FROM sys.dm_exec_cached_plans

    CROSS APPLY sys.dm_exec_query_plan(plan_handle) ;

    You might want to Cross Apply query_plan.nodes() down to the Statements level, if you have multiple statements in...

  • RE: isnumeric() ?

    dwain.c (6/8/2012)


    You might want to select out all the rows based on a PATINDEX that allows only numerics. Then you can examine what's actually in the data and what...

  • RE: Using the DelimitedSplit8k function - Help Jeff!

    In the SplitCMD function, is the number the position?

    And, are the arguments always one digit (I think that's what I'm seeing in your sample), or are they potentially longer?

  • RE: Insert XML into SQL Table

    You need to take "/sessions" out of there.

    You're already going to that level because of the nodes() piece, so you need to start at "/session". nodes() is correct, value()...

  • RE: Insert XML into SQL Table

    Sapen (6/7/2012)


    Is there a way that I can loop through if I have too many xml records?

    Not sure what you mean. Too many nodes in the XML?

  • RE: Tricky SQL - Please Help

    I've actually been seeing YMMV for many more years than SQL or HTTP or WWW. I know people were using YMMV in the '70s, because car ads had it...

  • RE: Need some help with a query

    Your innermost query will be a list of all the teachers from LA.

    Assuming a standard many-to-many structure, where you have a table-in-the-middle that has teachers and rooms in it, you...

  • RE: isnumeric() ?

    If you have IsNumeric in the Where clause, you can get some odd behavior, where it tries to convert out-of-range or invalid values to your numeric format, then filter them,...

  • RE: ITVF returning empy but the query inside returns results

    Recurs1on (6/7/2012)


    I figured it out. Sorry everyone, but this one has had nothing to do with SQL server, and everything to do with the person behind the keyboard. I accidentally...

  • RE: Need some help with a query

    The usual way to do that is to find the total count of teachers born in LA, then the count per room of teachers that were born in LA. ...

Viewing 15 posts - 1,366 through 1,380 (of 14,953 total)