Forum Replies Created

Viewing 15 posts - 4,456 through 4,470 (of 5,502 total)

  • RE: get date range for each week of the year

    What would be Week one for this year?

    Either from 01-02 (Fr - Sat) or 03-09 (Sun-Sat)?

    Or, to phrase it a little different:

    What needs to be the first day of 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: Help on comparing 2 rows for each id

    I would use the following code.

    The first CTE is used to order each guid per lastchanged column (desc order).

    The second CTE calculates the sum of the latest two rows.

    The final...



    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 Create a Temp table with Incr dates for each day

    Glad we could help 🙂



    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 convert SQL bit to XML boolean?

    Would something like the following code do the job?

    DECLARE @t TABLE (IsSet bit)

    INSERT INTO @t SELECT 1 UNION ALL SELECT 0

    SELECT

    CASE WHEN IsSet=0 THEN 'False' ELSE 'True' END 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]

  • RE: Merge 2 Column Values insert New Line between 2 column value

    dave.repton (1/21/2010)


    As far as I am aware SQL will not be able to provide the dataset in the way you require - you would need to handle the display of...



    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: Need help using While

    Why not using a solution that doesn't use any while loops at all and do it all in one path?

    ;with cte

    AS

    (

    SELECT

    BusTypeCode,

    n1 % (ncolLeft+nColRight) +1 AS Col_X,

    row_number() over(partition...



    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: Poor performance while using Union/Intersect on bulk data

    One reason could be that you're using UNION instead of UNION ALL.

    When combining two queries using UNION you'd force an (internal) DISTINCT to be applied to the result set, usually...



    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: Join tables by matching this month data and previous month data

    Would something like the following work?

    Please note that I added some more lines to make the concept a little easier to understand since your sample data could have been joined...



    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 top 1 accross a whole set

    Jeff Moden (1/19/2010)


    lmu92 (1/19/2010)


    When adding the following three samples to your data, which one should be displayed (each one has values in two out of three columns)?

    select 'fred', 'unsure', 33716,...



    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: (No column name) in Select statement

    Where do you get that result set from?

    Instead of auto-generating column names you should ensure to get a useable result set in the first place...



    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: Are the posted questions getting worse?

    Gianluca Sartori (1/20/2010)


    ...

    Gianluca Sartori (1/19/2010)


    What are writing about, Paul?

    I started writing my first article 9 months ago and it isn't finished yet.:crying:

    Well, I can say that I had a baby...



    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: Pivot table

    You would either have to add a column identifying year + month instead of month only and alter your PIVOT clause to reflect that or you might want to have...



    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: Export to Excel

    ... or you can set up an XLS file as a linked server

    ... or you can use SSIS

    ... or bcp

    ... or send an email with the data attached as xls...



    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: Split SP input

    I would use the input parameter and a split string function together with a join.

    Something like this:

    DECLARE @input1 as varchar(50)

    SET @input1 = '12,15,25,49'

    SELECT * FROM

    master..spt_values m inner join...



    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: Sorting Stored Procedures???

    Ooopss!! Sorry, my fault (I mixed Object Explorer and Object Explorer Details...):blush:



    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 - 4,456 through 4,470 (of 5,502 total)