Forum Replies Created

Viewing 15 posts - 3,091 through 3,105 (of 5,502 total)

  • RE: select hours

    Would you mind providing a few more details, please?

    Read to use format preferred (see the first link in my signature for details). Also, please include your expected result based on...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: database dropped -- recovery????

    Assuming the undelete option fails:

    Did the SQL Server copy/forward/transfer any data to other systems and/or did it receive any data from other sources (e.g. other DBs, flat files or the...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: string of data needs to be parsed to seperate columns

    If you know the number of values you could use the CrossTab method as an alternative to PIVOT.

    The advantage: Once you know the basics behind CrossTab you could explore DynamicCrossTab...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: string of data needs to be parsed to seperate columns

    I'm guessing your values are separated by a space?

    If so, search this site for a split string function (e.g. search for "DelimitedSplit8K").

    This function is the fastest (T-SQL) way I know...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Iterating thru XML entries

    I would wrap the XML shredding into a CTE or subquery and use ROW_NUMBER to get it sorted as required:

    ;WITH cte AS

    (

    SELECT

    title.value('E[1]','VARCHAR(100)') AS title,

    row.value('1+count(for $a in . return $a/../*[....



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: SQL to find indirect matches between two tables

    Please provide table DDL, sample data and expected result set based on the sample.

    Please read and follow the first link in my signature for posting data in a ready to...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: How do I calculate the week number given a date?

    How abouth the following solution?

    DECLARE @date DATETIME

    SET @date=GETDATE()

    SELECT

    CONVERT(CHAR(10),DATEADD(wk, DATEDIFF(wk, 0, @date - 7*n), -2),103)

    + ' - '

    + CONVERT(CHAR(10),DATEADD(wk, DATEDIFF(wk, 0, @date - 7*(n-1)), -3),103)

    FROM

    (

    SELECT 1 AS n UNION ALL

    SELECT...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Iterating thru XML entries

    You would need to add the reference to the TTITLE section:

    SELECT

    title.value('E[1]','VARCHAR(100)') AS title,

    row.value('1+count(for $a in . return $a/../*[. << $a])','INT')-2 AS ROW,

    col.value('1+count(for $a in . return $a/../*[. << $a])','INT')...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Select Smart query

    Here are two options you could use:

    --check for first name used as the first part of the last name

    SELECT *

    FROM @tbl

    WHERE LastName LIKE RTRIM(Fisrtname)+' %'

    -- check for a space...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: How to sort data in a row?

    It doesn't really sound like a normalized table design...

    Therefore, you might need to use some T-SQL code to UNPIVOT the data, sort it and PIVOT or CrossTab it back in...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Comma separated result

    Sagar Sawant (7/20/2010)


    Solved this query problem.

    Sagar

    Would you mind posting your solution? It's not only good forum etiquette.

    It might also help people solving a similar issue. Or you might even end...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Average Inventory (Stock) Age

    Hi Graham,

    😛 It's not my fault!! Jeff started it!! (or at least he's the one wroting the related article I usually refer to...) 😛

    But before giong all crazy make sure...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: How do I calculate the week number given a date?

    Jeff Moden (7/19/2010)


    ...

    Heh... looking back at some of the posts, I might be sorry for jumping in here. 😛

    Nothing to be sorry for!! You might be late but your...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Query Re-Write to Minimize Logical Reads

    Wouldn't it be easier to use

    SELECT COUNT(DISTINCT col2)

    FROM [Table A]

    WHERE col3 = 196

    Or am I missing something obvious?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Iterating thru XML entries

    Would the following help you to get closer to your expected result?

    SELECT

    row.value('1+count(for $a in . return $a/../*[. << $a])','INT')-2 AS row,

    col.value('1+count(for $a in . return $a/../*[. << $a])','INT') AS...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 15 posts - 3,091 through 3,105 (of 5,502 total)