Forum Replies Created

Viewing 15 posts - 1,006 through 1,020 (of 2,452 total)

  • RE: SQL2008R2 FIFO Allocation Recursive CTE

    ChrisM@Work (10/29/2015)


    J Livingston SQL (10/29/2015)


    Bruceo (10/29/2015)


    By the way, how do you format your results like that? I looked through all the shortcuts and could not figure it out!

    Is that an...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Calculating elapsed time between records

    my shot at this...first glance suggests I get different results from anthony

    but I have added and addtional row

    create table #test (empid int, start_date datetime, end_date datetime)

    insert into #test values

    (1001,'1998-01-01','2003-06-21'),

    (1001,'2004-01-01','2004-06-15'), ...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: SQL2008R2 FIFO Allocation Recursive CTE

    Bruceo (10/29/2015)


    By the way, how do you format your results like that? I looked through all the shortcuts and could not figure it out!

    Is that an image or just SQL...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Calculating elapsed time between records

    Mark Harley (10/29/2015)


    I have a table that contains an employee id and dates signifying time periods that those employees were working. I need to calculate anniversaries, such as 20...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: SQL2008R2 FIFO Allocation Recursive CTE

    Good spot, G. I've only tested the proposed solution on the sample data set provided by the OP. I think it would be trivial to tweak the query to account...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: SQL2008R2 FIFO Allocation Recursive CTE

    ChrisM@Work (10/29/2015)


    Try this - the result of some fiddling around earlier:

    -- Set up sample data

    DECLARE @Deductions TABLE (DeductionID int IDENTITY(1,1),DeductionAmount money);

    INSERT @Deductions (DeductionAmount) VALUES (1000),(200),(50),(600);

    DECLARE @Payments TABLE (PaymentID int IDENTITY(1,1),PaymentAmount...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Can this be done without a loop

    Phil Parkin (10/29/2015)


    J Livingston SQL (10/29/2015)


    see this article and read the comments from Jeff at the bottom of the article

    https://www.mssqltips.com/sqlservertip/3576/generate-random-strings-with-high-performance-with-a-sql-clr-function

    Excellent link and way too many Jeffs getting involved there!

    you are...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Can this be done without a loop

    see this article and read the comments from Jeff at the bottom of the article

    https://www.mssqltips.com/sqlservertip/3576/generate-random-strings-with-high-performance-with-a-sql-clr-function

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: How to get multiples rows and columns data into 1 single row - Help please?

    celine.godines (10/28/2015)


    It will be for multiple customers (I have about over 1000000)

    All customers have different products and different Names/Values... (and not always 2 products and 6 names, it will varies)

    I...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: need a query

    elham_azizi_62 (10/28/2015)


    thank you so much dear J Livingston SQL

    🙂

    I trust that you understand how this works?

    http://www.sqlservercentral.com/articles/T-SQL/103343/

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: How to get multiples rows and columns data into 1 single row - Help please?

    celine.godines (10/28/2015)


    I have the following results:

    CustomerProductName ValueChargesNewCharges

    13AZ 40005056

    13BY 30023

    13BX 50003536

    13BW 16001312

    13BV 107009392

    13BU 7000109110

    And would like to...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Date Function (Possibility)

    SQLPain (10/27/2015)


    there are some records in exported column those are NOT Null and it is also a DATETIME data type. If you look at the attached excel Loan '123123' is...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Date Function (Possibility)

    SQLPain (10/27/2015)


    I have edited my CREATE TEST TABLE DraftDT and RequestedDt to DATETIME if that helps.

    a suggestion...as you appear to be using Getdate() as a filter. then please provide...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: need a query

    maybe something along these lines will work for you.

    have only looked at Vacation

    WITH ctesecs as

    (

    SELECT

    A.FirstName

    , A.LastName

    , SUM(CASE

    WHEN DailyStartDate IS NULL THEN HourlyVacationEndTime...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: need a query

    elham_azizi_62 (10/26/2015)


    now I need to this result:

    for ali ahmadi:sum of vacation time=4 dayes and 2 houre

    I need this result to this format:HH:MM:SS(Houre:MInute:second)

    and either for mission.sum of Mission time:02:30:20

    sorry...but...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

Viewing 15 posts - 1,006 through 1,020 (of 2,452 total)