Forum Replies Created

Viewing 12 posts - 1,216 through 1,228 (of 1,228 total)

  • RE: Want to use WHILE loop in Stored procedure

    amitabhssinha (12/29/2009)


    I have a stored procedure that will take date period as one of the input, say, from 20th Dec to 27th Dec. Now I want to take one by...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Error in converting from datediff(,,) to Varchar()

    amitabhssinha (12/31/2009)


    This is part of my query:

    (CASE

    WHEN (DATEDIFF(second,Actual.ActualDepartTime,Schedule.SchdDepartTime)/60) >=60

    THEN Convert(nvarchar(10),(DATEDIFF(second,Actual.ActualDepartTime,Schedule.SchdDepartTime)/60)/60)+' '+'hr'

    Else (DATEDIFF(second,Actual.ActualDepartTime,Schedule.SchdDepartTime)/60) +' '+'min.'

    END) AS DeptEarly

    There's an error in your ELSE condition

    DROP TABLE #Actual

    DROP TABLE...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Normalize data using Pivot WITHOUT using Aggregate function

    Jeff Moden (12/30/2009)


    Man, in the presence of a clustered index on the ID, that's some mighty fast code there, Chris.

    :blush: thanks Jeff. I read your triangular join article!


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Normalize data using Pivot WITHOUT using Aggregate function

    Cheers Lutz!

    Having SQL Server handy to play with helps a bit ...

    Looks like the OP has at least two solutions to choose from & tweak to perfection. Job's a...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Normalize data using Pivot WITHOUT using Aggregate function

    Another overcomplicated effort from the peanut gallery.

    SELECT d.OutputRowNo,

    MAX(CASE ColumnName WHEN 'ID' THEN [Text] END) AS [ID],

    MAX(CASE ColumnName WHEN 'SubjectArea' THEN [Text] END) AS [SubjectArea],

    MAX(CASE ColumnName WHEN 'LocalCourseCode' THEN [Text]...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Are the posted questions getting worse?

    GSquared (12/29/2009)


    For anyone here a month or so ago, I have good news on the employment front. Starting a new job with a much better company in mid-Jan. ...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Normalize data using Pivot WITHOUT using Aggregate function

    Justin James (12/29/2009)


    There is not. I was thinking of using ROW_NUMBER(), but was unsure how to partition by each block of 6 rows.

    Like this:

    ;WITH CTE1 AS (

    SELECT ((UniqueID-1)/6)+1 AS CourseBlock,...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Normalize data using Pivot WITHOUT using Aggregate function

    Justin James (12/29/2009)


    Yes, that is correct. Each block of 6 is destined to become a singular row in the final table.

    Is there a missing column which would uniquely identify each...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Normalize data using Pivot WITHOUT using Aggregate function

    Hi Justin

    This might sound daft, but bear with me...

    How do you know that UniqueID 4 is the school for ID 123146, and not UniqueID 10? Or to put it ab

    another...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Are the posted questions getting worse?

    GilaMonster (12/28/2009)


    jcrawf02 (12/28/2009)


    if I can control my PC with words, gestures and simply my presence

    Why not, Gail? You do this with other people's servers all over the world...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: returning multiple rows from multiple tables to multiple columns in one row

    warrenstroebel (12/16/2009)


    I have successfully written most of it out in advance...

    Warren, does the following query generate the same results as yours, by any chance?

    SELECT TOP 1 e.EmployerName AS EmployerName1,

    e.EmployerName...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Best way to pull data for Crystal Report

    Gianluca Sartori (11/17/2009)


    No there isn't. The same applies to Crystal XI, just to be clear. The reporting engine has to know which columns will be returned by the procedure, so...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

Viewing 12 posts - 1,216 through 1,228 (of 1,228 total)