Project Description:
I would like you to write a function in SQL SERVER (stored procedure) .
Please find attached file containing the Data and I need the Function within the next couple of hours and I will pay you $30. I will be very grateful if you can.
The name of the table is: TRAIN_JOURNEY_TBL
The table structure and datatypes are below:
TRUSTID nvarchar(50)
Geography_Name_From nvarchar(101)
Geography_Name_To nvarchar(101)
Geography_Name_FWD nvarchar(101)
[Geography Code] nvarchar(10)
[Route Name] nvarchar(50)
[Timing Event Sequence] bigint
Step 1: Sort the records by: TRUSTID, [Timing Event Sequence]
Step 2: For Specific TRUSTID, Copy the next two Records and transpose it to the right of the first record. Repeat until end of record for specific TRUSTID and start again with another TRUSTID. For example, The TRUSTID Column Highlighted in Yellow, Column C3 & C4 will be copied to D2 & E2, C4 & C5 will be copied to D3 & E3. Repeat until the end for record (C13)
Start Process again For a different TRUSTID between C14 to C25.
If there are not enough record to populate all Column D and C then populate column C and leave Column D blank.
If a TRUSTID only has 2 records in column C then populate Column D only and do not fail.
Please note that I will be running the program on Billions of records and the table need to be properly indexed.
I have attached the file containing the sample data and explanation. I need the Job done within the next 1 to 2 hrs and I will pay $30.
First come first serve.