
This is a basic select statement, it starts out 'select' then all the rows coming from one table. Why are there '' and what function does that serve? I know about using column and table aliases, or naming a column with a different name 'AS something'. I have seen this several times and never knew what it was trying to perform.
SELECT '' AS prSkipCustomInfo
, '' AS WBS1
, '' AS WBS2
, '' AS WBS3
, '' AS SubLevel1
, '' AS SubLevel2
, '' AS SubLevel3
, '' AS WBS1Name
, '' AS ProjectManager
, '' AS Principal
, '' AS Supervisor
, '' AS ClientID
, '' AS ContactID
, '' AS ChargeType
, '' AS revType
, '' AS currencyCodeProj
, '' AS currencyCodeBill
, '' AS currencyCodeFunct
, '' AS currencyCodePres
, 0 AS currencyCodeProjCount
, 0 AS currencyCodeBillCount
, 0 AS currencyCodeFunctCount
, 0 AS currencyCodePresCount
, '' AS Account
, '' AS TransType
, '' AS SubType
, '' AS Transfer
, '' AS rectype
, '' AS rectypelabel
, '' AS rectypesub
, '' AS rectypesublabel
, 0 AS Period
, 0 AS PostSeq
, TransDate
, '' AS RefNo
, '' AS Desc1
, '' AS Desc2
, 0.00 AS Amount
, '' AS Invoice
, 0 AS Line
, '' AS VendOrg
, '' AS XferWBS1
, '' AS XferWBS2
, '' AS XferWBS3
, '' AS BillStatus
, '' AS AcctName
, '' AS AcctClass
, '' AS AcctSubClass
, '' AS Org
, '' AS Vendor
, '' AS VendName
, '' AS VendUnit
, '' AS Voucher
, '' AS Documents
, '' AS PKey
, 0 AS UnitQuantity
, 0.00 AS UnitBillRate
, 0.00 AS UnitCostRate
FROM dbo.LedgerAP
This is common pattern when you need some columns from table and the rest is simply placeholder to match desired resultset.
You will get as many rows as in table dbo.LEDGERAP.
SELECT
'' AS prSkipCustomInfo,
-- ...
TransDate, --here goes actual value from source table
--...
FROM dbo.LedgerAP
The '' is returning an empty string.
The simplest example of this is
select '' as EmptyString
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With