Solved

Extract full Sql Text from monSysSQLText

Posted on 2009-05-05
2
1,244 Views
Last Modified: 2012-05-06
I am trying to extract slow running Sql Text from monSysSQLText monitoring tables. because The size for monSysSQLText..SQLText is only varchar(255), the Sql Text is fragmented across different records.

Please see the code and its output from the code section

one Sql Text has 116 different records and other one has 24 records
I would like to have each Sql Text as a separate Linux file,  so can run this Sql Text for  P & T


I am running the following code:

set nocount on

go

use master

go

select

       T.SequenceInBatch,

       T.SQLText

from monSysSQLText T, monSysStatement S

where T.SPID = S.SPID and T.BatchID = S.BatchID

            and datediff (ss, StartTime, EndTime) > 1

order by datediff (ss, StartTime, EndTime) desc, T.SPID, T.BatchID, T.SequenceInBatch

go
 

The output I get is:

============================ Put Put Text ==========================

SequenceInBatch

SQLText

----------------------------------------------------

---------------------------------------------------------------------------------------------------------------------

               1

         select top 100 jobimpl0_.ID as ID285_0_, driverimpl1_.ID as ID280_1_, bookingimp2_.ID as ID99_2_, individual3_.ID as ID88_3_, serviceimp4_.ID as ID93_4_, driverimpl5_.ID as ID280_5_, driverimpl6_.ID as ID280_6_, customerac7_.ID as ID208_7_, jobimpl0_.UUID

               2

          as UUID285_0_, jobimpl0_.IS_DELETED as IS3_285_0_, jobimpl0_.CREATE_TS as CREATE4_285_0_, jobimpl0_.CREATED_BY as CREATED5_285_0_, jobimpl0_.UPDATE_TS as UPDATE6_285_0_, jobimpl0_.UPDATED_BY as UPDATED7_285_0_, jobimpl0_.DELETED_BY as DELETED8_285_0_, jo

               3

         bimpl0_.DELETE_TS as DELETE9_285_0_, jobimpl0_.VERSION as VERSION285_0_, jobimpl0_.CREATION_DATE as CREATION11_285_0_, jobimpl0_.CUSTOMER_ID as CUSTOMER110_285_0_, jobimpl0_.DRIVER_ID as DRIVER111_285_0_, jobimpl0_.SERVICE_ID as SERVICE112_285_0_, jobimpl

               4

         0_.REFERENCE_ID as REFERENCE113_285_0_, jobimpl0_.REFERENCE_VALUE as REFERENCE12_285_0_, jobimpl0_.PICKUP_CIRCUIT as PICKUP13_285_0_, jobimpl0_.DROP_CIRCUIT as DROP14_285_0_, jobimpl0_.JOURNEY_TIME as JOURNEY15_285_0_, jobimpl0_.JOURNEY_TYPE as JOURNEY16_

               5

         285_0_, jobimpl0_.CONTACT_ID as CONTACT114_285_0_, jobimpl0_.CONTACT_NAME as CONTACT17_285_0_, jobimpl0_.CONTACT_TELEPHONE as CONTACT18_285_0_, jobimpl0_.CONTACT_EMAIL as CONTACT19_285_0_, jobimpl0_.CREDIT_CARD_ID as CREDIT115_285_0_, jobimpl0_.CC_BANK_ID

               6

          as CC116_285_0_, jobimpl0_.CC_VALID_FROM as CC20_285_0_, jobimpl0_.CC_EXPIRES_END as CC21_285_0_, jobimpl0_.CC_NUMBER as CC22_285_0_, jobimpl0_.CC_ISSUE as CC23_285_0_, jobimpl0_.CC_NOTE as CC24_285_0_, jobimpl0_.CC_HOLDER_NAME as CC25_285_0_, jobimpl0_.

               7

         CC_BILLING_ADDRESS as CC26_285_0_, jobimpl0_.CC_BILLING_REQUIRED as CC27_285_0_, jobimpl0_.CC_EMAIL_ADDRESS as CC28_285_0_, jobimpl0_.AUTHORISE_REQUIRED as AUTHORISE29_285_0_, jobimpl0_.CC_LAST_FOUR_DIGITS_OF_NUMBER as CC30_285_0_, jobimpl0_.CONFIRM_BY_EM

               8

         AIL as CONFIRM31_285_0_, jobimpl0_.CONFIRM_BY_FAX as CONFIRM32_285_0_, jobimpl0_.NUMBER_OF_PASSENGERS as NUMBER33_285_0_, jobimpl0_.CONFIRMATION_EMAIL as CONFIRM34_285_0_, jobimpl0_.CLIENT_PRICE_TYPE_R2 as CLIENT35_285_0_, jobimpl0_.CLIENT_DISTANCE as CLI

               9

         ENT36_285_0_, jobimpl0_.CLIENT_DISTANCE_AUTO as CLIENT37_285_0_, jobimpl0_.CLIENT_JRN_COST as CLIENT38_285_0_, jobimpl0_.CLIENT_JRN_COST_AUTO as CLIENT39_285_0_, jobimpl0_.CLIENT_WAITING_TIME_COST as CLIENT40_285_0_, jobimpl0_.CLIENT_EXTRAS as CLIENT41_28

              10

         5_0_, jobimpl0_.CLIENT_READY_REPORTED as CLIENT42_285_0_, jobimpl0_.DRIVER_PRICE_TYPE_R2 as DRIVER43_285_0_, jobimpl0_.DRIVER_DISTANCE as DRIVER44_285_0_, jobimpl0_.DRIVER_DISTANCE_AUTO as DRIVER45_285_0_, jobimpl0_.DRIVER_JRN_COST as DRIVER46_285_0_, job

              11

         impl0_.DRIVER_JRN_COST_AUTO as DRIVER47_285_0_, jobimpl0_.DRIVER_WAITING_TIME_COST as DRIVER48_285_0_, jobimpl0_.DRIVER_EXTRAS as DRIVER49_285_0_, jobimpl0_.DRIVER_READY_REPORTED as DRIVER50_285_0_, jobimpl0_.FIRST_STOP_NAME as FIRST51_285_0_, jobimpl0_.L

              12

         AST_STOP_NAME as LAST52_285_0_, jobimpl0_.MAIN_PASSENGER_NAME as MAIN53_285_0_, jobimpl0_.REFERENCE_SCHEMA as REFERENCE117_285_0_, jobimpl0_.DRIVER_POINTS as DRIVER54_285_0_, jobimpl0_.MAIN_PASSENGER_TELEPHONE as MAIN55_285_0_, jobimpl0_.CLIENT_TOTAL_PRIC

              13

         E as CLIENT56_285_0_, jobimpl0_.DRIVER_TOTAL_PRICE as DRIVER57_285_0_, jobimpl0_.LOCKED as LOCKED285_0_, jobimpl0_.LOCKED_BY as LOCKED59_285_0_, jobimpl0_.NUMBER as NUMBER285_0_, jobimpl0_.CONTRACT_JOB_ID as CONTRACT118_285_0_, jobimpl0_.INVOICE_ID as INV

              14

         OICE119_285_0_, jobimpl0_.BOOKING_ID as BOOKING120_285_0_, jobimpl0_.VAT_RATE_ID as VAT121_285_0_, jobimpl0_.JOB_CURRENT_STATUS_TYPE as JOB61_285_0_, jobimpl0_.ROCS_CREATED_BY as ROCS62_285_0_, jobimpl0_.ROCS_AMENDED_BY as ROCS63_285_0_, jobimpl0_.TPC_STA

              15

         TUS_ID as TPC122_285_0_, jobimpl0_.DEADLINE as DEADLINE285_0_, jobimpl0_.CANCELLED as CANCELLED285_0_, jobimpl0_.ALLOCATED as ALLOCATED285_0_, jobimpl0_.STARTED as STARTED285_0_, jobimpl0_.CANCELLED_ON_ARRIVED as CANCELLED68_285_0_, jobimpl0_.COMPLETED as

              16

          COMPLETED285_0_, jobimpl0_.APPEARENCE_DATE as APPEARENCE70_285_0_, jobimpl0_.DELAY_REGION as DELAY71_285_0_, jobimpl0_.DELAY as DELAY285_0_, jobimpl0_.ROCS_ID as ROCS73_285_0_, jobimpl0_.PIN_CODE as PIN74_285_0_, jobimpl0_.INDIVIDUAL_ID as INDIVIDUAL123_

              17

         285_0_, jobimpl0_.ALLOCATED_BY as ALLOCATED75_285_0_, jobimpl0_.ALLOCATED_DATE as ALLOCATED76_285_0_, jobimpl0_.STARTED_DATE as STARTED77_285_0_, jobimpl0_.COMPLETED_DATE as COMPLETED78_285_0_, jobimpl0_.MASTER_JOB_ID as MASTER124_285_0_, jobimpl0_.FLI_BA

              18

         TCH_NUMBER as FLI79_285_0_, jobimpl0_.JOB_DATE as JOB80_285_0_, jobimpl0_.ASAP as ASAP285_0_, jobimpl0_.CREDIT_CARD_TRANSACTION_STATE as CREDIT82_285_0_, jobimpl0_.PAYMENT_TYPE as PAYMENT83_285_0_, jobimpl0_.ORIGIN as ORIGIN285_0_, jobimpl0_.PREALLOCATED_

              19

         DRIVER_ID as PREALL125_285_0_, jobimpl0_.PREBOOKED_DRIVER_ID as PREBOOKED126_285_0_, jobimpl0_.CC_TOTAL as CC85_285_0_, jobimpl0_.CC_TOTAL_AUTH as CC86_285_0_, jobimpl0_.CC_AUTH_NUMBER as CC87_285_0_, jobimpl0_.CC_AUTH_DATE as CC88_285_0_, jobimpl0_.PRICI

              20

         NG_QUERY as PRICING89_285_0_, jobimpl0_.CANCELLED_BY as CANCELLED90_285_0_, jobimpl0_.SHAMROCK_DELAY as SHAMROCK91_285_0_, jobimpl0_.PICKUP_CIRCUIT_ID as PICKUP127_285_0_, jobimpl0_.ZIP_EXPANDED_CONTROL_BOX as ZIP92_285_0_, jobimpl0_.CONTROL_BOX as CONTRO

              21

         L93_285_0_, jobimpl0_.STATUS as STATUS285_0_, jobimpl0_.WAITING_TIME as WAITING95_285_0_, jobimpl0_.PRIORITY as PRIORITY285_0_, jobimpl0_.TYPE as TYPE285_0_, jobimpl0_.IN_ACCOUNT as IN98_285_0_, jobimpl0_.JOB_CURRENT_STATUS as JOB128_285_0_, jobimpl0_.HAS

              22

         _UNPROCESSED_AMENDMENTS as HAS99_285_0_, jobimpl0_.CC_TOTALS_ALIGN_STATE as CC100_285_0_, jobimpl0_.IS_JOB_DATE_CONFIRMED as IS101_285_0_, jobimpl0_.NOT_AUTO_ALLOCATED as NOT102_285_0_, jobimpl0_.HOLDED as HOLDED285_0_, jobimpl0_.HOLDED_BY as HOLDED104_28

              23

         5_0_, jobimpl0_.HOLDED_TILL as HOLDED105_285_0_, jobimpl0_.IS_DELAYED as IS106_285_0_, jobimpl0_.CALCULATION_PERIOD_ID as CALCUL107_285_0_, jobimpl0_.CANCELED_TIMESTAMP as CANCELED108_285_0_, jobimpl0_.JOB_DISTANCE as JOB109_285_0_, driverimpl1_.UUID as U

              24

         UID280_1_, driverimpl1_.IS_DELETED as IS3_280_1_, driverimpl1_.CREATE_TS as CREATE4_280_1_, driverimpl1_.CREATED_BY as CREATED5_280_1_, driverimpl1_.UPDATE_TS as UPDATE6_280_1_, driverimpl1_.UPDATED_BY as UPDATED7_280_1_, driverimpl1_.DELETED_BY as DELETE

              25

         D8_280_1_, driverimpl1_.DELETE_TS as DELETE9_280_1_, driverimpl1_.VERSION as VERSION280_1_, driverimpl1_.NAME as NAME280_1_, driverimpl1_.VEHICLE_ID as VEHICLE84_280_1_, driverimpl1_.DRIVER_CONTRACT_ID as DRIVER85_280_1_, driverimpl1_.VEHICLE_ALLOCATION_I

              26

         D as VEHICLE86_280_1_, driverimpl1_.CALLSIGN_ID as CALLSIGN87_280_1_, driverimpl1_.BANK_ID as BANK88_280_1_, driverimpl1_.PCO_EXPIRY_DATE as PCO12_280_1_, driverimpl1_.LICENSE as LICENSE280_1_, driverimpl1_.XDA_DEVICE_ID as XDA89_280_1_, driverimpl1_.IMAG

              27

         E_ID as IMAGE90_280_1_, driverimpl1_.DRIVER_HOME_TOWN_ID as DRIVER91_280_1_, driverimpl1_.DRIVER_HOME_POSTCODE as DRIVER14_280_1_, driverimpl1_.ADDRESS as ADDRESS280_1_, driverimpl1_.DRIVER_HOME_PLACE_ID as DRIVER92_280_1_, driverimpl1_.LATITUDE as LATITU

              28

         DE280_1_, driverimpl1_.LONGITUDE as LONGITUDE280_1_, driverimpl1_.DRIVER_HOME_STREET_NAME as DRIVER18_280_1_, driverimpl1_.DRIVER_HOME_COMPANY as DRIVER19_280_1_, driverimpl1_.XDA_NUMBER as XDA20_280_1_, driverimpl1_.XDA_GATEWAY as XDA21_280_1_, driverimp

              29

         l1_.ROCS_ID as ROCS22_280_1_, driverimpl1_.XDA_TELEPHONE as XDA23_280_1_, driverimpl1_.SMART_NUMBER as SMART24_280_1_, driverimpl1_.TYPE_ID as TYPE93_280_1_, driverimpl1_.NUMBER as NUMBER280_1_, driverimpl1_.ID_EXP_DATE as ID26_280_1_, driverimpl1_.MOT_EX

              30

         PIRY_DATE as MOT27_280_1_, driverimpl1_.NEXT_OF_KIN as NEXT28_280_1_, driverimpl1_.NEXT_OF_KIN_TEL as NEXT29_280_1_, driverimpl1_.DRIVER_STATUS as DRIVER30_280_1_, driverimpl1_.STATUS as STATUS280_1_, driverimpl1_.LICENSE_TYPE as LICENSE32_280_1_, driveri

              31

         mpl1_.LICENSE_EXPIRY_DATE as LICENSE33_280_1_, driverimpl1_.LICENSE_PASSED_DATE as LICENSE34_280_1_, driverimpl1_.LICENSE_INSPECTED_DATE as LICENSE35_280_1_, driverimpl1_.LICENSE_POINTS as LICENSE36_280_1_, driverimpl1_.DRIVER_PCO_LICENCE_TYPE as DRIVER37

              32

         _280_1_, driverimpl1_.PAY_VAT as PAY38_280_1_, driverimpl1_.VAT_NUMBER as VAT39_280_1_, driverimpl1_.LICENCE_NUMBER as LICENCE40_280_1_, driverimpl1_.LICENCE_ADDRESS as LICENCE41_280_1_, driverimpl1_.ANALYSIS as ANALYSIS280_1_, driverimpl1_.DISCOUNT as DI

              33

         SCOUNT280_1_, driverimpl1_.CREDIT_TERM as CREDIT44_280_1_, driverimpl1_.CREDIT_LIMIT as CREDIT45_280_1_, driverimpl1_.CREDIT_DAYS as CREDIT46_280_1_, driverimpl1_.LOG_STATUS as LOG47_280_1_, driverimpl1_.CURRENT_LOCATION as CURRENT48_280_1_, driverimpl1_.

              34

         RADIO_NUMBER as RADIO49_280_1_, driverimpl1_.BLEEP_NUMBER as BLEEP50_280_1_, driverimpl1_.SOURCE as SOURCE280_1_, driverimpl1_.BANK_SORT_CODE as BANK52_280_1_, driverimpl1_.BANK_ACCOUNT_NO as BANK53_280_1_, driverimpl1_.BANK_ACCOUNT_TYPE as BANK54_280_1_,

              35

          driverimpl1_.POD_OUTSTANDING as POD55_280_1_, driverimpl1_.PAY_TYPE as PAY56_280_1_, driverimpl1_.START_DATE as START57_280_1_, driverimpl1_.LEAVE_DATE as LEAVE58_280_1_, driverimpl1_.BACS_BS_ROLL_NO as BACS59_280_1_, driverimpl1_.PAY_YTD as PAY60_280_1_

              36

         , driverimpl1_.MEDICAL as MEDICAL280_1_, driverimpl1_.NOTES as NOTES280_1_, driverimpl1_.IS_NEW_DRIVER as IS63_280_1_, driverimpl1_.QUERY as QUERY280_1_, driverimpl1_.NATIONAL_INSURANCE as NATIONAL65_280_1_, driverimpl1_.TAX_EXPIRY_DATE as TAX66_280_1_, d

              37

         riverimpl1_.MOBILE_TEL as MOBILE67_280_1_, driverimpl1_.CAR_WASH as CAR68_280_1_, driverimpl1_.EMAIL_ADDRESS as EMAIL69_280_1_, driverimpl1_.FAX as FAX280_1_, driverimpl1_.BBF as BBF280_1_, driverimpl1_.DRIVER_CATEGORY as DRIVER72_280_1_, driverimpl1_.DAT

              38

         E_OF_BIRTH as DATE73_280_1_, driverimpl1_.PCO_NUMBER as PCO74_280_1_, driverimpl1_.TELEPHONE as TELEPHONE280_1_, driverimpl1_.ROCS_ACCOUNT_TRANSFER_DATE as ROCS76_280_1_, driverimpl1_.ROCS_ADDRESS1 as ROCS77_280_1_, driverimpl1_.ROCS_ADDRESS2 as ROCS78_28

              39

         0_1_, driverimpl1_.ROCS_ADDRESS3 as ROCS79_280_1_, driverimpl1_.ROCS_ADDRESS4 as ROCS80_280_1_, driverimpl1_.CALLSIGN as CALLSIGN280_1_, driverimpl1_.VEHICLE_MODEL as VEHICLE82_280_1_, driverimpl1_.VEHICLE_REG_NUMBER as VEHICLE83_280_1_, bookingimp2_.UUID

              40

          as UUID99_2_, bookingimp2_.IS_DELETED as IS3_99_2_, bookingimp2_.CREATE_TS as CREATE4_99_2_, bookingimp2_.CREATED_BY as CREATED5_99_2_, bookingimp2_.UPDATE_TS as UPDATE6_99_2_, bookingimp2_.UPDATED_BY as UPDATED7_99_2_, bookingimp2_.DELETED_BY as DELETED

              41

         8_99_2_, bookingimp2_.DELETE_TS as DELETE9_99_2_, bookingimp2_.VERSION as VERSION99_2_, bookingimp2_.CREATION_DATE as CREATION11_99_2_, bookingimp2_.TYPE as TYPE99_2_, bookingimp2_.CALL_ID as CALL13_99_2_, bookingimp2_.PHONE_NUMBER as PHONE14_99_2_, indiv

              42

         idual3_.UUID as UUID88_3_, individual3_.IS_DELETED as IS3_88_3_, individual3_.CREATE_TS as CREATE4_88_3_, individual3_.CREATED_BY as CREATED5_88_3_, individual3_.UPDATE_TS as UPDATE6_88_3_, individual3_.UPDATED_BY as UPDATED7_88_3_, individual3_.DELETED_B

              43

         Y as DELETED8_88_3_, individual3_.DELETE_TS as DELETE9_88_3_, individual3_.VERSION as VERSION88_3_, individual3_.NAME as NAME88_3_, individual3_.CUSTOMER_ID as CUSTOMER33_88_3_, individual3_.PIN as PIN88_3_, individual3_.PIN_ID as PIN34_88_3_, individual3

              44

         _.TYPE as TYPE88_3_, individual3_.SUPERVISOR as SUPERVISOR88_3_, individual3_.MASTER_SUPERVISOR as MASTER15_88_3_, individual3_.GLOBAL as GLOBAL88_3_, individual3_.PARTNER_RULE_SETTINGS_ID as PARTNER35_88_3_, individual3_.LAST_USED_IN_JOBS as LAST17_88_3_

              45

         , individual3_.IS_DEFAULT_CONTACT as IS18_88_3_, individual3_.IS_DEFAULT_PASSENGER as IS19_88_3_, individual3_.IS_DEFAULT_PAYER as IS20_88_3_, individual3_.SEC_USER as SEC36_88_3_, individual3_.SECURITY_ROLE as SECURITY21_88_3_, individual3_.EXTRA_DELAY a

              46

         s EXTRA22_88_3_, individual3_.EXTRA_PRIORITY as EXTRA23_88_3_, individual3_.EXPIRE_DATE_EXTRA_DELAY as EXPIRE24_88_3_, individual3_.EXPIRE_DATE_EXTRA_PRIORITY as EXPIRE25_88_3_, individual3_.AVAIL_SERV_ONLY_IN_LIST as AVAIL26_88_3_, individual3_.UPPER_NAM

              47

         E as UPPER27_88_3_, individual3_.UPPER_PIN_CODE as UPPER28_88_3_, individual3_.CLEANUP_ENABLED as CLEANUP29_88_3_, individual3_.INDIVIDUAL_STATUS as INDIVIDUAL30_88_3_, individual3_.STATUS_REASON as STATUS31_88_3_, individual3_.IS_PROFILE_INDIV as IS32_88

              48

         _3_, serviceimp4_.UUID as UUID93_4_, serviceimp4_.IS_DELETED as IS3_93_4_, serviceimp4_.CREATE_TS as CREATE4_93_4_, serviceimp4_.CREATED_BY as CREATED5_93_4_, serviceimp4_.UPDATE_TS as UPDATE6_93_4_, serviceimp4_.UPDATED_BY as UPDATED7_93_4_, serviceimp4_

              49

         .DELETED_BY as DELETED8_93_4_, serviceimp4_.DELETE_TS as DELETE9_93_4_, serviceimp4_.VERSION as VERSION93_4_, serviceimp4_.CODE as CODE93_4_, serviceimp4_.DESCRIPTION as DESCRIP12_93_4_, serviceimp4_.WEB_DESCRIPTION as WEB13_93_4_, serviceimp4_.WEB_IMAGE

              50

         as WEB14_93_4_, serviceimp4_.MAX_NO_OF_PASSENGERS as MAX15_93_4_, serviceimp4_.PODS_REQUIRED as PODS16_93_4_, serviceimp4_.AVAILABLE_ON_WEB as AVAILABLE17_93_4_, serviceimp4_.AVAILABLE_ON_TBS as AVAILABLE18_93_4_, serviceimp4_.CREDIT_CARD_ALLOWED as CREDI

              51

         T19_93_4_, serviceimp4_.CASH_ALLOWED as CASH20_93_4_, serviceimp4_.CLINET_DISCOUNT_ALLOWED as CLINET21_93_4_, serviceimp4_.CLIENT_VAT_APPLIES as CLIENT22_93_4_, serviceimp4_.DEFAULT_VAT_ID as DEFAULT57_93_4_, serviceimp4_.VAT_INCLUSIVE as VAT23_93_4_, ser

              52

         viceimp4_.NOMINAL_JOB_SALES_ID as NOMINAL58_93_4_, serviceimp4_.NOMINAL_JOB_COST_ID as NOMINAL59_93_4_, serviceimp4_.NOMINAL_WT_SALES_ID as NOMINAL60_93_4_, serviceimp4_.NOMINAL_WT_COST_ID as NOMINAL61_93_4_, serviceimp4_.NOMINAL_EXTRA_SALES_ID as NOMINAL

              53

         62_93_4_, serviceimp4_.NOMINAL_EXTRA_COST_ID as NOMINAL63_93_4_, serviceimp4_.IS_PASSENGER as IS24_93_4_, serviceimp4_.IS_DELIVERY as IS25_93_4_, serviceimp4_.IS_CHAUFFEUR as IS26_93_4_, serviceimp4_.BOOKING_INFORMATION as BOOKING27_93_4_, serviceimp4_.MA

              54

         X_WEIGHT as MAX28_93_4_, serviceimp4_.MIN_WEIGHT as MIN29_93_4_, serviceimp4_.AS_DIRECTED_RATE as AS30_93_4_, serviceimp4_.PARTNER_RULE_SETTINGS_ID as PARTNER64_93_4_, serviceimp4_.PREBOOKING_SERVICE_GROUP_ID as PREBOOKING65_93_4_, serviceimp4_.PRICING_ST

              55

         RATEGY_ID as PRICING66_93_4_, serviceimp4_.WEB_ORDER as WEB31_93_4_, serviceimp4_.BASE_TARIFF_ID as BASE67_93_4_, serviceimp4_.CONTROLLER_SCREEN_COLOUR2 as CONTROLLER32_93_4_, serviceimp4_.EXTRA_PRIORITY as EXTRA33_93_4_, serviceimp4_.EXTRA_DELAY as EXTRA

              56

         34_93_4_, serviceimp4_.EXPIRE_DATE_EXTRA_DELAY as EXPIRE35_93_4_, serviceimp4_.EXPIRE_DATE_EXTRA_PRIORITY as EXPIRE36_93_4_, serviceimp4_.PRIORITY as PRIORITY93_4_, serviceimp4_.CS_BACKGROUND_COLOUR as CS38_93_4_, serviceimp4_.ALLOW_AUTO_ALLOCATION as ALL

              57

         OW39_93_4_, serviceimp4_.ALLOCATOR_EXTRA_BUFFER as ALLOCATOR40_93_4_, serviceimp4_.ALLOCATOR_PRIORITY as ALLOCATOR41_93_4_, serviceimp4_.ALLOCATOR_EMPTY_TIME_PREFERENCE_MAX_DIST as ALLOCATOR42_93_4_, serviceimp4_.ALLOCATOR_D5_PENALTY as ALLOCATOR43_93_4_,

              58

          serviceimp4_.ALLOCATOR_D10_PENALTY as ALLOCATOR44_93_4_, serviceimp4_.ALLOCATOR_AIRPORT_MULTIPLIER as ALLOCATOR45_93_4_, serviceimp4_.AA_SEND_MSG_TO_CLOSEST as AA46_93_4_, serviceimp4_.AA_SEND_DELAY_PASSED as AA47_93_4_, serviceimp4_.AA_TYPE_DESCR as AA4

              59

         8_93_4_, serviceimp4_.AA_SEND_SORT_SEQUENCE as AA49_93_4_, serviceimp4_.ALLOW_WEB_DISCOUNT as ALLOW50_93_4_, serviceimp4_.WEB_DISCOUNT as WEB51_93_4_, serviceimp4_.DELAY as DELAY93_4_, serviceimp4_.TIME_FROM as TIME53_93_4_, serviceimp4_.TIME_TO as TIME54

              60

         _93_4_, serviceimp4_.DAYS as DAYS93_4_, serviceimp4_.REQUIRE_CHECK_AVAILABILITY as REQUIRE56_93_4_, driverimpl5_.UUID as UUID280_5_, driverimpl5_.IS_DELETED as IS3_280_5_, driverimpl5_.CREATE_TS as CREATE4_280_5_, driverimpl5_.CREATED_BY as CREATED5_280_5

              61

         _, driverimpl5_.UPDATE_TS as UPDATE6_280_5_, driverimpl5_.UPDATED_BY as UPDATED7_280_5_, driverimpl5_.DELETED_BY as DELETED8_280_5_, driverimpl5_.DELETE_TS as DELETE9_280_5_, driverimpl5_.VERSION as VERSION280_5_, driverimpl5_.NAME as NAME280_5_, driverim

              62

         pl5_.VEHICLE_ID as VEHICLE84_280_5_, driverimpl5_.DRIVER_CONTRACT_ID as DRIVER85_280_5_, driverimpl5_.VEHICLE_ALLOCATION_ID as VEHICLE86_280_5_, driverimpl5_.CALLSIGN_ID as CALLSIGN87_280_5_, driverimpl5_.BANK_ID as BANK88_280_5_, driverimpl5_.PCO_EXPIRY_

              63

         DATE as PCO12_280_5_, driverimpl5_.LICENSE as LICENSE280_5_, driverimpl5_.XDA_DEVICE_ID as XDA89_280_5_, driverimpl5_.IMAGE_ID as IMAGE90_280_5_, driverimpl5_.DRIVER_HOME_TOWN_ID as DRIVER91_280_5_, driverimpl5_.DRIVER_HOME_POSTCODE as DRIVER14_280_5_, dr

              64

         iverimpl5_.ADDRESS as ADDRESS280_5_, driverimpl5_.DRIVER_HOME_PLACE_ID as DRIVER92_280_5_, driverimpl5_.LATITUDE as LATITUDE280_5_, driverimpl5_.LONGITUDE as LONGITUDE280_5_, driverimpl5_.DRIVER_HOME_STREET_NAME as DRIVER18_280_5_, driverimpl5_.DRIVER_HOM

              65

         E_COMPANY as DRIVER19_280_5_, driverimpl5_.XDA_NUMBER as XDA20_280_5_, driverimpl5_.XDA_GATEWAY as XDA21_280_5_, driverimpl5_.ROCS_ID as ROCS22_280_5_, driverimpl5_.XDA_TELEPHONE as XDA23_280_5_, driverimpl5_.SMART_NUMBER as SMART24_280_5_, driverimpl5_.T

              66

         YPE_ID as TYPE93_280_5_, driverimpl5_.NUMBER as NUMBER280_5_, driverimpl5_.ID_EXP_DATE as ID26_280_5_, driverimpl5_.MOT_EXPIRY_DATE as MOT27_280_5_, driverimpl5_.NEXT_OF_KIN as NEXT28_280_5_, driverimpl5_.NEXT_OF_KIN_TEL as NEXT29_280_5_, driverimpl5_.DRI

              67

         VER_STATUS as DRIVER30_280_5_, driverimpl5_.STATUS as STATUS280_5_, driverimpl5_.LICENSE_TYPE as LICENSE32_280_5_, driverimpl5_.LICENSE_EXPIRY_DATE as LICENSE33_280_5_, driverimpl5_.LICENSE_PASSED_DATE as LICENSE34_280_5_, driverimpl5_.LICENSE_INSPECTED_D

              68

         ATE as LICENSE35_280_5_, driverimpl5_.LICENSE_POINTS as LICENSE36_280_5_, driverimpl5_.DRIVER_PCO_LICENCE_TYPE as DRIVER37_280_5_, driverimpl5_.PAY_VAT as PAY38_280_5_, driverimpl5_.VAT_NUMBER as VAT39_280_5_, driverimpl5_.LICENCE_NUMBER as LICENCE40_280_

              69

         5_, driverimpl5_.LICENCE_ADDRESS as LICENCE41_280_5_, driverimpl5_.ANALYSIS as ANALYSIS280_5_, driverimpl5_.DISCOUNT as DISCOUNT280_5_, driverimpl5_.CREDIT_TERM as CREDIT44_280_5_, driverimpl5_.CREDIT_LIMIT as CREDIT45_280_5_, driverimpl5_.CREDIT_DAYS as

              70

         CREDIT46_280_5_, driverimpl5_.LOG_STATUS as LOG47_280_5_, driverimpl5_.CURRENT_LOCATION as CURRENT48_280_5_, driverimpl5_.RADIO_NUMBER as RADIO49_280_5_, driverimpl5_.BLEEP_NUMBER as BLEEP50_280_5_, driverimpl5_.SOURCE as SOURCE280_5_, driverimpl5_.BANK_S

              71

         ORT_CODE as BANK52_280_5_, driverimpl5_.BANK_ACCOUNT_NO as BANK53_280_5_, driverimpl5_.BANK_ACCOUNT_TYPE as BANK54_280_5_, driverimpl5_.POD_OUTSTANDING as POD55_280_5_, driverimpl5_.PAY_TYPE as PAY56_280_5_, driverimpl5_.START_DATE as START57_280_5_, driv

              72

         erimpl5_.LEAVE_DATE as LEAVE58_280_5_, driverimpl5_.BACS_BS_ROLL_NO as BACS59_280_5_, driverimpl5_.PAY_YTD as PAY60_280_5_, driverimpl5_.MEDICAL as MEDICAL280_5_, driverimpl5_.NOTES as NOTES280_5_, driverimpl5_.IS_NEW_DRIVER as IS63_280_5_, driverimpl5_.Q

              73

         UERY as QUERY280_5_, driverimpl5_.NATIONAL_INSURANCE as NATIONAL65_280_5_, driverimpl5_.TAX_EXPIRY_DATE as TAX66_280_5_, driverimpl5_.MOBILE_TEL as MOBILE67_280_5_, driverimpl5_.CAR_WASH as CAR68_280_5_, driverimpl5_.EMAIL_ADDRESS as EMAIL69_280_5_, drive

              74

         rimpl5_.FAX as FAX280_5_, driverimpl5_.BBF as BBF280_5_, driverimpl5_.DRIVER_CATEGORY as DRIVER72_280_5_, driverimpl5_.DATE_OF_BIRTH as DATE73_280_5_, driverimpl5_.PCO_NUMBER as PCO74_280_5_, driverimpl5_.TELEPHONE as TELEPHONE280_5_, driverimpl5_.ROCS_AC

              75

         COUNT_TRANSFER_DATE as ROCS76_280_5_, driverimpl5_.ROCS_ADDRESS1 as ROCS77_280_5_, driverimpl5_.ROCS_ADDRESS2 as ROCS78_280_5_, driverimpl5_.ROCS_ADDRESS3 as ROCS79_280_5_, driverimpl5_.ROCS_ADDRESS4 as ROCS80_280_5_, driverimpl5_.CALLSIGN as CALLSIGN280_

              76

         5_, driverimpl5_.VEHICLE_MODEL as VEHICLE82_280_5_, driverimpl5_.VEHICLE_REG_NUMBER as VEHICLE83_280_5_, driverimpl6_.UUID as UUID280_6_, driverimpl6_.IS_DELETED as IS3_280_6_, driverimpl6_.CREATE_TS as CREATE4_280_6_, driverimpl6_.CREATED_BY as CREATED5_

              77

         280_6_, driverimpl6_.UPDATE_TS as UPDATE6_280_6_, driverimpl6_.UPDATED_BY as UPDATED7_280_6_, driverimpl6_.DELETED_BY as DELETED8_280_6_, driverimpl6_.DELETE_TS as DELETE9_280_6_, driverimpl6_.VERSION as VERSION280_6_, driverimpl6_.NAME as NAME280_6_, dri

              78

         verimpl6_.VEHICLE_ID as VEHICLE84_280_6_, driverimpl6_.DRIVER_CONTRACT_ID as DRIVER85_280_6_, driverimpl6_.VEHICLE_ALLOCATION_ID as VEHICLE86_280_6_, driverimpl6_.CALLSIGN_ID as CALLSIGN87_280_6_, driverimpl6_.BANK_ID as BANK88_280_6_, driverimpl6_.PCO_EX

              79

         PIRY_DATE as PCO12_280_6_, driverimpl6_.LICENSE as LICENSE280_6_, driverimpl6_.XDA_DEVICE_ID as XDA89_280_6_, driverimpl6_.IMAGE_ID as IMAGE90_280_6_, driverimpl6_.DRIVER_HOME_TOWN_ID as DRIVER91_280_6_, driverimpl6_.DRIVER_HOME_POSTCODE as DRIVER14_280_6

              80

         _, driverimpl6_.ADDRESS as ADDRESS280_6_, driverimpl6_.DRIVER_HOME_PLACE_ID as DRIVER92_280_6_, driverimpl6_.LATITUDE as LATITUDE280_6_, driverimpl6_.LONGITUDE as LONGITUDE280_6_, driverimpl6_.DRIVER_HOME_STREET_NAME as DRIVER18_280_6_, driverimpl6_.DRIVE

              81

         R_HOME_COMPANY as DRIVER19_280_6_, driverimpl6_.XDA_NUMBER as XDA20_280_6_, driverimpl6_.XDA_GATEWAY as XDA21_280_6_, driverimpl6_.ROCS_ID as ROCS22_280_6_, driverimpl6_.XDA_TELEPHONE as XDA23_280_6_, driverimpl6_.SMART_NUMBER as SMART24_280_6_, driverimp

              82

         l6_.TYPE_ID as TYPE93_280_6_, driverimpl6_.NUMBER as NUMBER280_6_, driverimpl6_.ID_EXP_DATE as ID26_280_6_, driverimpl6_.MOT_EXPIRY_DATE as MOT27_280_6_, driverimpl6_.NEXT_OF_KIN as NEXT28_280_6_, driverimpl6_.NEXT_OF_KIN_TEL as NEXT29_280_6_, driverimpl6

              83

         _.DRIVER_STATUS as DRIVER30_280_6_, driverimpl6_.STATUS as STATUS280_6_, driverimpl6_.LICENSE_TYPE as LICENSE32_280_6_, driverimpl6_.LICENSE_EXPIRY_DATE as LICENSE33_280_6_, driverimpl6_.LICENSE_PASSED_DATE as LICENSE34_280_6_, driverimpl6_.LICENSE_INSPEC

              84

         TED_DATE as LICENSE35_280_6_, driverimpl6_.LICENSE_POINTS as LICENSE36_280_6_, driverimpl6_.DRIVER_PCO_LICENCE_TYPE as DRIVER37_280_6_, driverimpl6_.PAY_VAT as PAY38_280_6_, driverimpl6_.VAT_NUMBER as VAT39_280_6_, driverimpl6_.LICENCE_NUMBER as LICENCE40

              85

         _280_6_, driverimpl6_.LICENCE_ADDRESS as LICENCE41_280_6_, driverimpl6_.ANALYSIS as ANALYSIS280_6_, driverimpl6_.DISCOUNT as DISCOUNT280_6_, driverimpl6_.CREDIT_TERM as CREDIT44_280_6_, driverimpl6_.CREDIT_LIMIT as CREDIT45_280_6_, driverimpl6_.CREDIT_DAY

              86

         S as CREDIT46_280_6_, driverimpl6_.LOG_STATUS as LOG47_280_6_, driverimpl6_.CURRENT_LOCATION as CURRENT48_280_6_, driverimpl6_.RADIO_NUMBER as RADIO49_280_6_, driverimpl6_.BLEEP_NUMBER as BLEEP50_280_6_, driverimpl6_.SOURCE as SOURCE280_6_, driverimpl6_.B

              87

         ANK_SORT_CODE as BANK52_280_6_, driverimpl6_.BANK_ACCOUNT_NO as BANK53_280_6_, driverimpl6_.BANK_ACCOUNT_TYPE as BANK54_280_6_, driverimpl6_.POD_OUTSTANDING as POD55_280_6_, driverimpl6_.PAY_TYPE as PAY56_280_6_, driverimpl6_.START_DATE as START57_280_6_,

              88

          driverimpl6_.LEAVE_DATE as LEAVE58_280_6_, driverimpl6_.BACS_BS_ROLL_NO as BACS59_280_6_, driverimpl6_.PAY_YTD as PAY60_280_6_, driverimpl6_.MEDICAL as MEDICAL280_6_, driverimpl6_.NOTES as NOTES280_6_, driverimpl6_.IS_NEW_DRIVER as IS63_280_6_, driverimp

              89

         l6_.QUERY as QUERY280_6_, driverimpl6_.NATIONAL_INSURANCE as NATIONAL65_280_6_, driverimpl6_.TAX_EXPIRY_DATE as TAX66_280_6_, driverimpl6_.MOBILE_TEL as MOBILE67_280_6_, driverimpl6_.CAR_WASH as CAR68_280_6_, driverimpl6_.EMAIL_ADDRESS as EMAIL69_280_6_,

              90

         driverimpl6_.FAX as FAX280_6_, driverimpl6_.BBF as BBF280_6_, driverimpl6_.DRIVER_CATEGORY as DRIVER72_280_6_, driverimpl6_.DATE_OF_BIRTH as DATE73_280_6_, driverimpl6_.PCO_NUMBER as PCO74_280_6_, driverimpl6_.TELEPHONE as TELEPHONE280_6_, driverimpl6_.RO

              91

         CS_ACCOUNT_TRANSFER_DATE as ROCS76_280_6_, driverimpl6_.ROCS_ADDRESS1 as ROCS77_280_6_, driverimpl6_.ROCS_ADDRESS2 as ROCS78_280_6_, driverimpl6_.ROCS_ADDRESS3 as ROCS79_280_6_, driverimpl6_.ROCS_ADDRESS4 as ROCS80_280_6_, driverimpl6_.CALLSIGN as CALLSIG

              92

         N280_6_, driverimpl6_.VEHICLE_MODEL as VEHICLE82_280_6_, driverimpl6_.VEHICLE_REG_NUMBER as VEHICLE83_280_6_, customerac7_.UUID as UUID208_7_, customerac7_.IS_DELETED as IS3_208_7_, customerac7_.CREATE_TS as CREATE4_208_7_, customerac7_.CREATED_BY as CREA

              93

         TED5_208_7_, customerac7_.UPDATE_TS as UPDATE6_208_7_, customerac7_.UPDATED_BY as UPDATED7_208_7_, customerac7_.DELETED_BY as DELETED8_208_7_, customerac7_.DELETE_TS as DELETE9_208_7_, customerac7_.VERSION as VERSION208_7_, customerac7_.NAME as NAME208_7_

              94

         , customerac7_.MAIN_OFFICE_ID as MAIN94_208_7_, customerac7_.BILLING_ADDRESS_ID as BILLING95_208_7_, customerac7_.NOTES as NOTES208_7_, customerac7_.NUMBER as NUMBER208_7_, customerac7_.SALES_LEDGER_ID as SALES96_208_7_, customerac7_.TYPE as TYPE208_7_, c

              95

         ustomerac7_.GRADE_ID as GRADE97_208_7_, customerac7_.LAST_REVIEW_GRADE_DATE as LAST15_208_7_, customerac7_.BUSINESS_AREA_ID as BUSINESS98_208_7_, customerac7_.ANALYSIS as ANALYSIS208_7_, customerac7_.STATUS_ID as STATUS99_208_7_, customerac7_.CREDIT_TERM_

              96

         ID as CREDIT100_208_7_, customerac7_.INVOICE_FREQ_NO as INVOICE17_208_7_, customerac7_.MAX_JOBS_PER_INVOICE as MAX18_208_7_, customerac7_.THRESHOLD_JOBS as THRESHOLD19_208_7_, customerac7_.THRESHOLD_AMOUNT as THRESHOLD20_208_7_, customerac7_.VAT_RATE_ID a

              97

         s VAT101_208_7_, customerac7_.SHOW_VAT_ON_INVOICE as SHOW21_208_7_, customerac7_.FACTOR_NUMBER as FACTOR22_208_7_, customerac7_.INVOICING_POLICY_ID as INVOICING102_208_7_, customerac7_.NEW_PAGE_PER_REF_CHANGE as NEW23_208_7_, customerac7_.CREDIT_LIMIT as

              98

         CREDIT24_208_7_, customerac7_.CREDIT_DAYS as CREDIT25_208_7_, customerac7_.SORTED_REFS as SORTED26_208_7_, customerac7_.DISCOUNT_RATE as DISCOUNT27_208_7_, customerac7_.SERVICE_CHARGE as SERVICE28_208_7_, customerac7_.FIXED_SERVICE_CHARGE as FIXED29_208_7

              99

         _, customerac7_.SETTLEMENT_CHARGE as SETTLEMENT30_208_7_, customerac7_.CREDIT_CHARGE as CREDIT31_208_7_, customerac7_.CREDIT_CHARGE_DAYS as CREDIT32_208_7_, customerac7_.NO_LONGER_USED as NO33_208_7_, customerac7_.DEF_SERVICE_ID as DEF103_208_7_, customer

             100

         ac7_.LEAD_TYPE as LEAD104_208_7_, customerac7_.PROFILE_SETTINGS_ID as PROFILE105_208_7_, customerac7_.USE_FIXED_PRICING as USE34_208_7_, customerac7_.SALESMAN_ID as SALESMAN106_208_7_, customerac7_.SALESMAN_DATE as SALESMAN35_208_7_, customerac7_.START_DA

             101

         TE as START36_208_7_, customerac7_.IS_POD_REQUIRED as IS37_208_7_, customerac7_.MESSAGE as MESSAGE208_7_, customerac7_.SETTLEMENT_CHARGE_DAYS as SETTLEMENT39_208_7_, customerac7_.VAT_REG_NUMBER as VAT40_208_7_, customerac7_.FAO as FAO208_7_, customerac7_.

             102

         USE_ZONE_PRICING as USE42_208_7_, customerac7_.USE_WEB as USE43_208_7_, customerac7_.USE_ABS as USE44_208_7_, customerac7_.BANK_INFO_ID as BANK107_208_7_, customerac7_.SHOW_BANK_ON_INVOICE as SHOW45_208_7_, customerac7_.WEB_PASSWORD as WEB46_208_7_, custo

             103

         merac7_.DISCOUNTED_PRICE_ON_SCHEDULE as DISCOUNTED47_208_7_, customerac7_.INVOICE_SITE_ID as INVOICE108_208_7_, customerac7_.SOURCE as SOURCE208_7_, customerac7_.SPARE as SPARE208_7_, customerac7_.ACCOUNT_MANAGER_ID as ACCOUNT109_208_7_, customerac7_.PARE

             104

         NT_ID as PARENT110_208_7_, customerac7_.CURRENCY as CURRENCY208_7_, customerac7_.INVOICE_PRINT as INVOICE51_208_7_, customerac7_.INVOICE_EMAIL as INVOICE52_208_7_, customerac7_.EXCEL_FORMAT as EXCEL53_208_7_, customerac7_.DEFAULT_CIRCUIT as DEFAULT54_208_

             105

         7_, customerac7_.DEFAULT_PRICEBAND as DEFAULT55_208_7_, customerac7_.LAST_USED as LAST56_208_7_, customerac7_.LAST_MONTH_SPENT as LAST57_208_7_, customerac7_.REGULAR_EXPENSES as REGULAR58_208_7_, customerac7_.SHOW_PRICE_ON_WEB as SHOW59_208_7_, customerac

             106

         7_.SHOW_CALLERS_ON_WEB as SHOW60_208_7_, customerac7_.HOW_HEAR_COMMENT as HOW61_208_7_, customerac7_.HOW_HEAR_ADDITIONAL as HOW62_208_7_, customerac7_.USE_PERSONAL_PROFILES as USE63_208_7_, customerac7_.PARTNER_RULE_SETTINGS_ID as PARTNER111_208_7_, custo

             107

         merac7_.BOOKING_NOTE as BOOKING64_208_7_, customerac7_.CUSTOMER_GROUP_ID as CUSTOMER112_208_7_, customerac7_.AB_PRECRECORD_ID as AB113_208_7_, customerac7_.REFERENCE_PATTERN as REFERENCE65_208_7_, customerac7_.REFERENCE_EXAMPLE as REFERENCE66_208_7_, cust

             108

         omerac7_.DELAY as DELAY208_7_, customerac7_.APPEARANCE_LAG as APPEARANCE68_208_7_, customerac7_.JOB_SORT_COLUMNS as JOB69_208_7_, customerac7_.REFERENCE_SORT_ORDER as REFERENCE70_208_7_, customerac7_.INVOICE_CLEARANCE_TYPE as INVOICE71_208_7_, customerac7

             109

         _.INVOICE_CREDIT_CARD_ID as INVOICE114_208_7_, customerac7_.EXTRA_DELAY as EXTRA72_208_7_, customerac7_.EXTRA_PRIORITY as EXTRA73_208_7_, customerac7_.EXPIRE_DATE_EXTRA_DELAY as EXPIRE74_208_7_, customerac7_.EXPIRE_DATE_EXTRA_PRIORITY as EXPIRE75_208_7_,

             110

         customerac7_.MULTY_REFERENCE_SUPPORT as MULTY76_208_7_, customerac7_.ROCS_ACCOUNT_TRANSFER_DATE as ROCS77_208_7_, customerac7_.ROCS_TYPE as ROCS78_208_7_, customerac7_.BOOKING_EMAIL as BOOKING79_208_7_, customerac7_.ALLOW_AUTO_ALLOCATION as ALLOW80_208_7_

             111

         , customerac7_.IS_REF_PATTERN_REG_EXPR as IS81_208_7_, customerac7_.NOT_POPULATE_CONTACT_ON_WEB as NOT82_208_7_, customerac7_.NOT_POPULATE_PASSENGER_ON_WEB as NOT83_208_7_, customerac7_.NOT_USED_VARCHAR_255 as NOT84_208_7_, customerac7_.WORKING_TIME_FROM

             112

         as WORKING85_208_7_, customerac7_.WORKING_TIME_TO as WORKING86_208_7_, customerac7_.WORKING_TIME_ON_CREATE as WORKING87_208_7_, customerac7_.NO_VAT_TO_ROCS_PRICE as NO88_208_7_, customerac7_.CNT_JOBS_WP_REPORT as CNT89_208_7_, customerac7_.RECEIVED_PROMOT

             113

         IONAL_EMAIL as RECEIVED90_208_7_, customerac7_.HIDE_CREDIT_CARDS as HIDE91_208_7_, customerac7_.PASSENGER_EMAIL_NEEDED as PASSENGER92_208_7_, customerac7_.EXTRA_PRIORITY_NOTES as EXTRA93_208_7_ from SL_JOBS jobimpl0_ left outer join SL_DRIVERS driverimpl1

             114

         _ on jobimpl0_.PREALLOCATED_DRIVER_ID=driverimpl1_.ID left outer join SL_BOOKINGS bookingimp2_ on jobimpl0_.BOOKING_ID=bookingimp2_.ID left outer join SL_INDIVIDUALS individual3_ on jobimpl0_.INDIVIDUAL_ID=individual3_.ID left outer join SL_SERVICES servi

             115

         ceimp4_ on jobimpl0_.SERVICE_ID=serviceimp4_.ID left outer join SL_DRIVERS driverimpl5_ on jobimpl0_.PREBOOKED_DRIVER_ID=driverimpl5_.ID left outer join SL_DRIVERS driverimpl6_ on jobimpl0_.DRIVER_ID=driverimpl6_.ID left outer join SL_CUSTOMER_ACCOUNTS cu

             116

         stomerac7_ on jobimpl0_.CUSTOMER_ID=customerac7_.ID where jobimpl0_.IS_DELETED=0 and jobimpl0_.CUSTOMER_ID=@p0 and jobimpl0_.JOB_DATE>=@p1 and jobimpl0_.JOB_DATE<=@p2 order by jobimpl0_.ID asc

               1

         Select cl.ID as ID217_0_, cl.UUID as UUID217_0_, cl.IS_DELETED as IS3_217_0_, cl.CREATE_TS as CREATE4_217_0_, cl.CREATED_BY as CREATED5_217_0_, cl.UPDATE_TS as UPDATE6_217_0_, cl.UPDATED_BY as UPDATED7_217_0_, cl.DELETED_BY as DELETED8_217_0_, cl.DELETE_T

               2

         S as DELETE9_217_0_, cl.NAME as NAME217_0_, cl.CUSTOMER_ID as CUSTOMER23_217_0_, cl.TOWN_ID as TOWN24_217_0_, cl.POSTCODE as POSTCODE217_0_, cl.ADDRESS as ADDRESS217_0_, cl.LOCATION_ID as LOCATION25_217_0_, cl.LATITUDE as LATITUDE217_0_, cl.LONGITUDE as L

               3

         ONGITUDE217_0_, cl.STREET_NAME as STREET15_217_0_, cl.COMPANY as COMPANY217_0_, cl.SPECIAL_INSTRUCTION as SPECIAL17_217_0_, cl.LOCKED_SPECIAL_INSTRUCTION as LOCKED18_217_0_, cl.GLOBAL as GLOBAL217_0_, cl.SPECIAL_PLACE_ID as SPECIAL26_217_0_, cl.LAST_USED_

               4

         IN_JOBS as LAST20_217_0_, cl.IS_DEFAULT_DROP as IS21_217_0_, cl.IS_DEFAULT_PICKUP as IS22_217_0_, n.ID as ID131_2_, n.UUID as UUID131_2_, n.IS_DELETED as IS3_131_2_, n.CREATE_TS as CREATE4_131_2_, n.CREATED_BY as CREATED5_131_2_, n.UPDATE_TS as UPDATE6_13

               5

         1_2_, n.UPDATED_BY as UPDATED7_131_2_, n.DELETED_BY as DELETED8_131_2_, n.DELETE_TS as DELETE9_131_2_, n.VERSION as VERSION131_2_, n.NAME as NAME131_2_, p.ID as ID88_3_, p.UUID as UUID88_3_, p.IS_DELETED as IS3_88_3_, p.CREATE_TS as CREATE4_88_3_, p.CREAT

               6

         ED_BY as CREATED5_88_3_, p.UPDATE_TS as UPDATE6_88_3_, p.UPDATED_BY as UPDATED7_88_3_, p.DELETED_BY as DELETED8_88_3_, p.DELETE_TS as DELETE9_88_3_, p.VERSION as VERSION88_3_, p.NAME as NAME88_3_, p.LONGITUDE as LONGITUDE88_3_, p.LATITUDE as LATITUDE88_3_

               7

         , p.POSTCODE as POSTCODE88_3_, p.SECTOR as SECTOR88_3_, p.NUMBER as NUMBER88_3_, p.FULL_NAME as FULL17_88_3_, p.GRID_REF as GRID18_88_3_, p.IN_USE as IN19_88_3_, p.COUNTY_ID as COUNTY33_88_3_, p.ROOT_ID as ROOT34_88_3_, p.USE_FIXED_PRICE as USE20_88_3_, p

               8

         .MESSAGE as MESSAGE88_3_, p.NOTES as NOTES88_3_, p.CENTRAL as CENTRAL88_3_, p.DELAY_REGION as DELAY24_88_3_, p.PARTNER_REGION_ID as PARTNER35_88_3_, p.PREBOOKING_REGION_ID as PREBOOKING36_88_3_, p.PICKUP_REGION_ID as PICKUP37_88_3_, p.LOADING_UNITS_DRIVER

               9

          as LOADING25_88_3_, p.LOADING_UNITS_CLIENT as LOADING26_88_3_, p.PICKUP_CHARGE_ACCOUNT_DRIVER as PICKUP27_88_3_, p.PICKUP_CHARGE_ACCOUNT_CLIENT as PICKUP28_88_3_, p.PICKUP_CHARGE_CASH_DRIVER as PICKUP29_88_3_, p.PICKUP_CHARGE_CASH_CLIENT as PICKUP30_88_3

              10

         _, p.PICKUP_CHARGE_CARD_DRIVER as PICKUP31_88_3_, p.PICKUP_CHARGE_CARD_CLIENT as PICKUP32_88_3_, av.ID as ID101_1_, av.UUID as UUID101_1_, av.IS_DELETED as IS3_101_1_, av.CREATE_TS as CREATE4_101_1_, av.CREATED_BY as CREATED5_101_1_, av.UPDATE_TS as UPDAT

              11

         E6_101_1_, av.UPDATED_BY as UPDATED7_101_1_, av.DELETED_BY as DELETED8_101_1_, av.DELETE_TS as DELETE9_101_1_, av.NAME as NAME101_1_, av.ADDRESS_ID as ADDRESS20_101_1_, av.EMPLOYEE_ID as EMPLOYEE21_101_1_, av.PICKUP_FREQUENCY as PICKUP11_101_1_, av.DROP_F

              12

         REQUENCY as DROP12_101_1_, av.PASSENGER_PICKUP_FREQUENCY as PASSENGER13_101_1_, av.PASSENGER_DROP_FREQUENCY as PASSENGER14_101_1_, av.DELIVERY_PICKUP_FREQUENCY as DELIVERY15_101_1_, av.DELIVERY_DELIVERY_DROP_FREQUENCY as DELIVERY16_101_1_, av.IS_DEFAULT_D

              13

         ROP_LOCATION as IS17_101_1_, av.IS_DEFAULT_PICKUP_LOCATION as IS18_101_1_, av.SPECIAL_INSTRUCTION as SPECIAL19_101_1_

from (

       Select [CUSTOMER_LOCATION_ID],

              max([DefaultFlag]) as [DefaultFlag],

              max([SERVICE_FREQUENCY]

              14

         ) as [SERVICE_FREQUENCY],

              max([FREQUENCY]) as [FREQUENCY]

       from (

              Select [ADDRESS_ID] as [CUSTOMER_LOCATION_ID],

                     case

                       when [IS_DEFAULT_PICKUP_LOCATION] = 1 then 3
 

              15

                        else 0

                     end as [DefaultFlag],

                     isnull([PASSENGER_PICKUP_FREQUENCY], 0) as [SERVICE_FREQUENCY],

                     isnull([PICKUP_FREQUENCY], 0) as [FREQUENCY]

              from [SL_AVAILABLE_AD

              16

         DRESSES]

              where [EMPLOYEE_ID] = @p0

                and [IS_DELETED] = 0

              Union all

              Select [ID] as [CUSTOMER_LOCATION_ID],

                     case

                       when [IS_DEFAULT_PICKUP] = 1 then 1
 

              17

                                else 0

                     end as [DefaultFlag],

                     -2 as [SERVICE_FREQUENCY],

                     -2 as [FREQUENCY]

              from [SL_CUSTOMER_LOCATIONS]

              where [CUSTOMER_ID] =  @p1
 

              18

                    and [IS_DELETED] = 0

                and ([GLOBAL] = 1 or [IS_DEFAULT_PICKUP] = 1)

              Union all

              Select [ADDRESS_ID] as [CUSTOMER_LOCATION_ID],

                     case

                       when [IS_DEFAULT_PICKU

              19

         P_LOCATION] = 1 then 2

                       else 0

                     end as [DefaultFlag],

                     -1 as [SERVICE_FREQUENCY],

                     -1 as [FREQUENCY]

              from [SL_AVAILABLE_ADDRESSES]

              inner jo

              20

         in (select profile.[ID] as [PROFILE_ID]

                          from [SL_INDIVIDUALS] as ind

                          inner join [SL_PIN] as pin

                             on pin.[ID] = ind.[PIN_ID]

                          inner join [SL_INDIVI

              21

         DUALS] as profile

                             on pin.[PROFILE_INDIVIDUAL_ID] = profile.[ID]

                          where ind.[ID] = @p2

                          ) pinAvInd

                 on [EMPLOYEE_ID] = [PROFILE_ID]

                    and

              22

         [IS_DELETED] = 0

            ) t

       group by [CUSTOMER_LOCATION_ID]

     ) t

  inner join [SL_CUSTOMER_LOCATIONS] cl

    on cl.[CUSTOMER_ID] = @p3

   and cl.[ID] = t.[CUSTOMER_LOCATION_ID]

   and cl.[IS_DELETED] = 0

   left join [SL_AVAILABLE_

              23

         ADDRESSES] av

    on av.[ADDRESS_ID] = cl.[ID] and av.[EMPLOYEE_ID] = @p4

  left join [SL_TOWNS] n

    on n.[ID] = cl.[TOWN_ID]

  left join [SL_PLACES] p

    on p.[ID] = cl.[LOCATION_ID]

order by t.[DefaultFlag] desc, t.[SERVICE_FREQUENCY] desc, t

              24

         .[FREQUENCY] desc, cl.[NAME]
 

======== End of Out Pur ==================

Open in new window

0
Comment
Question by:Peteri99
2 Comments
 
LVL 19

Accepted Solution

by:
grant300 earned 100 total points
ID: 24306088
I'm afraid you are going to have to use something other than T-SQL to get this formatted and output to a file.  116*255 is way over the maximum page/variable size of 16K so you have no way to hold an accumulated intermediate value in T-SQL.

I would suggest something like Java or Perl with the SybPerl add in.  If you are pre-v15 and have the Java extension licensed or are post 15 and have the Java extension turned on, you can do this with a Java stored procedure.  That would be the neatest way to do this.  If you get it working, please post it as it will be generally useful for many folks.

Regards,
Bill
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Moving applications to the cloud or switching services to cloud-based ones, is a stressful job.  Here's how you can make it easier.
Use of TCL script on Cisco devices:  - create file and merge it with running configuration to apply configuration changes
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now