Forum Replies Created

Viewing 15 posts - 76 through 90 (of 1,473 total)

  • RE: Pivot or Unpivot, or both

    At first glance, this doesn't seem like just a simple unpivot. I'm assuming this is just an issue in your sample data, but you don't have any field in...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Getting Data from Oracle to Sql Server using Procedure

    We end up pulling data from Oracle quite often. SQL Server can create Linked Servers To Oracle, and you can also use OPENQUERY to pull data across.

    Here...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Pivot or Unpivot, or both

    Greetings,

    Please refer to the link in my signature on how to provide usable sample data.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Multi-part key restriction query

    Sorry if this is oversimplifying your query, but do you just mean:

    SELECT * FROM Table1 EXCEPT (SELECT * FROM Table2) ?

    Example:

    CREATE TABLE #A(

    a int,

    b int)

    INSERT INTO #A SELECT 5,1

    INSERT INTO...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Pivot the result of the select statement

    This should work. See the link in my signature on Crosstabs/pivots for additional information on how this works.

    DECLARE @x xml

    SELECT @x='<MoreProperties>

    <Property>

    <Key>property1</Key>

    <Value>value1</Value>

    </Property>

    <Property>

    <Key>property2</Key>

    <Value>value2</Value>

    </Property>

    <Property>

    <Key>property3</Key>

    <Value>value3</Value>

    </Property>

    <Property>

    <Key>property4</Key>

    <Value>value4</Value>

    </Property>

    </MoreProperties>'

    ;WITH A AS (

    select

    n.value('Key[1]','varchar(30)') as [Key],

    n.value('Value[1]','varchar(30)') as [Value]

    FROM...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Join Rows within the same table

    Glad I could help. As to the explanations:

    The ';WITH C1 AS' is the beginning declaration of a Common Table Expression (or CTE). In this case it's a recursive...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Join Rows within the same table

    Thanks for the sample data. This should do the trick.

    Note that this won't work until you fix the 'NULL' in your sample data to be just NULL instead.

    ;WITH C1...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: How to get the difference between First column First value and First column Last value in result set of a stored procedure?

    As Mike said, you'll get better, faster results posting usable sample data in the fashion he supplies below. That said, I had a few minutes to kill, so here's...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: TRICKY SQL QUERY

    Anytime sir =)

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Calculate growth - difference between currnet and previous row with a little twist

    I'm quite sure this could be cleaned up a lot, but here's one quick solution. This should work on 2005+. As a side note, thanks so much for...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: TRICKY SQL QUERY

    Martin,

    Chris was suggesting this book:

    http://www.amazon.co.uk/Microsoft-SQL-Server-2008-Dummies/dp/0470224657 You can pick it up online. You can also get all of the books I listed on Amazon.

    The Understanding and using APPLY (I)...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: TSQL Programming Book

    I really need to write the blog post I was going to do on this, but in the interim, I'd have to also lend my vote to Itzik's book(s). ...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Cursor performance

    The performance hit is still *there* for a small number of rows, it's just much harder to see because you're probably dealing with milliseconds. The biggest problem with non...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: SQL 2000 Running Total Reset

    Please refer to the article in my signature on how to post sample data.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Interesting problem for the "Running Total/Quirky Update" method of removing cursors

    Although the max recursion is only a bit over 32K, any change in criteria will restart that recursion. You could easily run it on millions of rows... or it...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing 15 posts - 76 through 90 (of 1,473 total)