Forum Replies Created

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

  • RE: select hours

    Since we don't have a table including sample data, your request to "go over the intire table" simply returns an error.

    Like I stated before: please provide DDL and sample data...

  • RE: building a date from getdate()

    Something like this?

    SELECT DATEADD(MONTH,DATEDIFF(MONTH,0,GETDATE())-2 ,0),GETDATE()

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

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

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

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

  • 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/../*[....

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

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

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

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

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

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

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

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

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