SELECT clause - too much space in columns calculations

1 Posts
1 Users
0 Reactions
37 Views
(@kmpel)
Member
Joined: 3 months ago
Posts: 13
Topic starter  

There is too much space in the select columns, pushing some parts of the calculations to the right side. It's often too far to support easy calculation readability.

MSSQL, profile used: jr5

image
SELECT
    CtrlRecordId   =                                                                                                                        DataSource.CtrlRecordId
   ,[AccountName]  =                                                                                                                        'AMEX'
   ,TransactionURC = CONVERT(NVARCHAR(MAX), DataSource.[Date], 103) + ' | ' + CONVERT(NVARCHAR(MAX), -1 * DataSource.Amount) + ' | ' +      DataSource.Reference
   ,TransactionOperation = IIF((-1 * DataSource.Amount) >= 0 , 'CREDIT', 'DEBIT')
   ,TransactionDate   =                                                                                                                     DataSource.[Date]
   ,TransactionTime   = CONVERT(TIME, NULL)
   ,AmountOnAccount   = -1 *                                                                                                                DataSource.Amount
   ,LocalAmount       = -1 *                                                                                                                DataSource.Amount
   ,LocalCurrencyCode =                                                                                                                     'GBP'
   ,TransactionType   =                                                                                                                     DataSource.Category
   ,Description1      =                                                                                                                     DataSource.AppearsOnYourStatementAs
   ,Description2      =                                                                                                                     DataSource.[Description]
   ,Description3      =                                                                                                                     DataSource.ExtendedDetails
   ,UserComment       =                                                                                                                     NULL

FROM StageTyped.AMEXBA_0001__StatementLong DataSource
WHERE DataSource.CtrlCargoRecordValidityFlagId < 100
    AND DataSource.CtrlETLStatusFlagId         = 1

/*-----------------------------------------------------------------------------------------------------------------------------
--expected behaviour:

SELECT
    CtrlRecordId         = DataSource.CtrlRecordId
   ,[AccountName]        = 'AMEX'
   ,TransactionURC       = CONVERT(NVARCHAR(MAX), DataSource.[Date], 103) + ' | ' + CONVERT(NVARCHAR(MAX), -1 * DataSource.Amount) + ' | ' + DataSource.Reference
   ,TransactionOperation = IIF((-1 * DataSource.Amount) >= 0 , 'CREDIT', 'DEBIT')
   ,TransactionDate      = DataSource.[Date]
   ,TransactionTime      = CONVERT(TIME, NULL)
   ,AmountOnAccount      = -1 * DataSource.Amount
   ,LocalAmount          = -1 * DataSource.Amount
   ,LocalCurrencyCode    = 'GBP'
   ,TransactionType      = DataSource.Category
   ,Description1         = DataSource.AppearsOnYourStatementAs
   ,Description2         = DataSource.[Description]
   ,Description3         = DataSource.ExtendedDetails
   ,UserComment          = NULL

FROM StageTyped.AMEXBA_0001__StatementLong DataSource
WHERE DataSource.CtrlCargoRecordValidityFlagId < 100
    AND DataSource.CtrlETLStatusFlagId         = 1
-----------------------------------------------------------------------------------------------------------------------------*/

 



   
Quote
Share: