Forum Replies Created

Viewing 15 posts - 1,336 through 1,350 (of 3,957 total)

  • RE: What is your favorite "I didn't know that" moment in T-SQL?

    Jeff Moden (8/8/2013)


    Sean Lange (8/8/2013)


    I can still remember one of those Eureka moments. I was reading a post from Wayne Sheffield and he explained that in order to understand set...

  • RE: lookup table for minutes of a day

    polkadot (10/7/2013)


    I am making a permanent table. But I need the datetime without the zeros on end.

    just

    2009-10-20 21:45

    not

    2009-10-20 21:45:00.000

    A DATETIME data type will always have those zeroes...

  • RE: single quotes

    Kurt W. Zimmerman (10/7/2013)


    A simple way to debug dynamic SQL is to simply print it out. Then copy/paste the output into a New Query window and see where your...

  • RE: Unpivot SQL Query

    And by the way, I don't think you can "configure a 2008 server to run as 2005" but a 2008 server can run databases at a lower compatibility level.

    Try this...

  • RE: Unpivot SQL Query

    rs80 (10/7/2013)


    I'm using SQL Server 2008 R2. However, I think the database might be configured to run as SQL Server 2005 (9.0).

    The expected result that I want is:

    ProductID ...

  • RE: Unpivot SQL Query

    Duplicate post. All replies here please: http://www.sqlservercentral.com/Forums/Topic1502389-392-1.aspx

  • RE: Unpivot SQL Query

    Note this is cross-posted to the SQL 2005 forum. Please clarify which version of SQL you are working in.

  • RE: How to collapse rows but take a specific value?

    Certainly no way around the CASE but I might do it this way so as to only have to CASE it once.

    WITH SampleData (accountNumber, MaturityDate, ResetFreq, Amount) AS

    (

    ...

  • RE: Unpivot SQL Query

    I'm a bit confused by your question as I'm thinking maybe you need to PIVOT and not UNPIVOT.

    Could you clarify by giving your expected results?

  • RE: import string with array into table

    But it can also be done with a single call to PatternSplitCM:

    WITH SampleData(MyString) AS

    (

    SELECT' [{mark,peters,mr}{jane,fonda,mrs}{john,doo,mr}{james,bond,mr}]'

    )

    SELECT MyString

    ,Col1=MAX(CASE WHEN ItemNumber%6 = 2 THEN Item...

  • RE: import string with array into table

    Alan.B (10/7/2013)


    You can also use PatternSplitCM (note the link in my signature)....

    declare @val varchar(8000)= '[{mark,peters,mr}{jane,fonda,mrs}{john,doo,mr}{james,bond,mr}]';

    WITH x AS

    (

    SELECT ItemNumber, Item

    FROM dbo.PatternSplitCM(REPLACE(REPLACE(@val,'[{',''),'}]',''),'%[}{]%')

    WHERE Matched=0

    )

    SELECTROW_NUMBER() OVER (ORDER BY x.ItemNumber) AS Id,

    MAX(CASE WHEN ps.ItemNumber=1...

  • RE: Order with unpivot

    Tom - You might want to look at the first article in my signature links for a (sometimes) faster way to UNPIVOT.

    Doesn't do the ordering for you though. You...

  • RE: Update Columns dependency over other column on same table

    Sean Pearce (10/7/2013)


    Dwain, I meant no offence ...

    No problem sir and none taken.

  • RE: Group on predominant fuzzy time

    It appears I'm also late to the party but perhaps this is another alternative:

    SELECT EventName, Venue, EventDate

    ,IDs=STUFF((

    SELECT ',...

  • RE: Group Islands of Contiguous Dates (SQL Spackle)

    I skimmed the article but I couldn't really identify what's new in this re-publish.

    I don't suppose you could give us a quick synopsis Jeff?

Viewing 15 posts - 1,336 through 1,350 (of 3,957 total)