Forum Replies Created

Viewing 15 posts - 1 through 15 (of 45 total)

  • RE: Extracting Episode Start and End Dates From Multiple Assignments

    Excellent, thank you Des and Chris.  I will be studying this today!  I always love posting here, I learn something new every time.

  • RE: Re-ordering a Sequence

    Having said that, I would prefer to not rely on an "edited" column being updated by the client as client times could be inaccurate/time zone dependent.

    I would either replace that...

  • RE: Re-ordering a Sequence

    mister.magoo (8/21/2016)


    How is this not just a simple update/cte?

    WITH CTE AS

    (

    SELECT

    seq

    , ROW_NUMBER() OVER

    (

    ...

  • RE: Re-ordering a Sequence

    CELKO (8/17/2016)


    I apologize for this half answer, but in some of my books I have an update statement that uses a case expression (not a case statement, please?) To move...

  • RE: Re-ordering a Sequence

    drew.allen (8/17/2016)


    I realized this morning that my code needed a slight update. My updates sample data had the same ordering for the from_seq and the to_seq, but that is...

  • RE: Re-ordering a Sequence

    drew.allen (8/16/2016)


    Here is a version that allows you to update multiple records at the same time.

    DECLARE @a TABLE (

    seqINT,

    orig_seq INT

    )

    INSERT @a( seq, orig_seq)

    VALUES(1, 1), (2, 2),...

  • RE: Re-ordering a Sequence

    Luis Cazares (8/16/2016)


    An additional clause should do the trick.

    WITH CTE AS(

    SELECT *, ROW_NUMBER() OVER( ORDER BY CASE WHEN seq = @OldSeq THEN @NewSeq

    ...

  • RE: Re-ordering a Sequence

    Luis Cazares (8/16/2016)


    What about this?

    create table #temp(seq int,step varchar(50))

    insert into #temp (seq,step) values (1,'do this first')

    insert into #temp (seq,step) values (2,'then do this')

    insert into #temp (seq,step) values (3,'finally do this')

    insert...

  • RE: Re-ordering a Sequence

    Luis Cazares (8/16/2016)


    How would you identify which step 1 is the first and which one is the second?

    Ah good point :Whistling: That was most likely my stumbling block prior to...

  • RE: Can DatabaseMail attach a formatted Excel file?

    Lavanyasri (11/30/2015)


    Thanks a lot. it worked for me also.

    But still i am getting ------ one complete row after the header columns

    I started this thread years ago - brings...

  • RE: Data Shuffle Question

    drew.allen (8/12/2015)


    This works by creating a "loop" in a random order and assigning the previous person in the loop as the reviewer.

    DECLARE @temp TABLE (id int,logonid varchar(15),reviewer varchar(15))

    insert into...

  • RE: Data Shuffle Question

    Luis Cazares (8/12/2015)


    Does the assignment need to be balanced?

    Yes. By balanced I'm guessing you mean each Logonid must be assigned as a Reviewer and can only be assigned once.

    Thank...

  • RE: Data Shuffle Question

    Jack Corbett (8/12/2015)


    A different person to each what?

    Something like this will create a random order:

    SELECT * FROM #temp AS T ORDER BY NEWID();

    For example, personA would be assigned...

  • RE: Data Shuffle Question

    Luis Cazares (8/12/2015)


    Are you missing information? Where do you get the persons that will be assigned? Are those the reviewers?

    Those listed in the Logonid column will be the reviewers. So...

  • RE: Data Shuffle Question

    Those listed in the Logonid column are the reviewes. So personA might be assigned to personC etc. PersonA obviously can't be assigned as a reviewer to PersonA, that...

Viewing 15 posts - 1 through 15 (of 45 total)