Home > database >  Change headers to yellow in SQL (inside the query)
Change headers to yellow in SQL (inside the query)

Time:11-06

I have a query that is just some selects with joins.

I wanted to ask if that is possible to change headers to yellow in SQL code?

enter image description here

SELECT TOP 20   
     a.demand_chain, item, descr, hist_type, fcst_cnt, loc_oh_cnt, ckb_cnt, oh_total
FROM
    (SELECT 
         U_CHAINNAME AS Demand_Chain, 
         [ITEM],
         DMDUNIT.DESCR,
         COUNT(SKU.[LOC]) loc_oh_cnt,
         SUM([OH]) AS OH_Total
     FROM 
         [BYIntegration].[SCPOMGR].[SKU] SKU

CodePudding user response:

it is not possible because colors are not a part of what SQL Server returns.

SQL Server returns DATA - ONLY.

SSMS is not a front end tool, it is purely an administrator's toolbox.

So, it also does not offer this function.

CodePudding user response:

If i got it right you want to change the headers in the query result set for further copying, for example, to an Excel spreadsheet, then you should use aliases like this:

SELECT TOP 20   
     a.demand_chain As [Demand Chain], item As [DMDUnit], descr As [Descr], hist_type As [Hist type], 
     fcst_cnt As [Current 111 DFU Count], loc_oh_cnt As [# Active Records (CKB)], ckb_cnt As [CKB Count], oh_total As [OH Qty]
FROM
    (SELECT 
         U_CHAINNAME AS Demand_Chain, 
         [ITEM],
         DMDUNIT.DESCR,
         COUNT(SKU.[LOC]) loc_oh_cnt,
         SUM([OH]) AS OH_Total
     FROM 
         [BYIntegration].[SCPOMGR].[SKU] SKU
  • Related