Hi
How to get the column header for the export file using BCP
I tried with the follwoing :
CREATE VIEW VW_INV_CO_APAC_EXTRACTION
AS
SELECT 'i_invenory_id' as i_invenory_id,
'i_provider_a' as i_provider_a,
'i_service_id' as i_service_id,
'i_service_description' as i_service_description,
'i_data_value' as i_data_value,
'i_units' as i_units,
'i_client_centre_id' as i_client_centre_id,
'i_provider_b'as i_provider_b,
'i_client_centre_id_2' as i_client_centre_id_2,
'extr_date' as extr_date,
'scenario' as scenario,
'month_date' as month_Date
UNION ALL
SELECT
(
CAST(iu.source_id AS VARCHAR) + '_' +
CAST(iu.inventory_entry AS VARCHAR)
) i_inventory_id
,ISNULL(iu.product_identif
ier_a, 'Unknown_Product') i_provider_a
,cast(ds.source_id as varchar(20)) i_service_id
,ds.source_name i_service_description
,cast(ISNULL(iu.data_value
, 0) as varchar(20)) i_data_value
,cast(ISNULL(iu.no_of_unit
s, 0) as varchar(20)) i_units
,iu.cost_centre_code i_client_centre_id
,ISNULL(iu.product_identif
ier_b, 'Unknown_Product') i_provider_b
,(
iu.cost_centre_code + '_' +
CAST(iu.source_id AS VARCHAR)
) i_client_centre_id_2
,(
CONVERT(CHAR(8),GETDATE(),
112)+' '+
CONVERT(CHAR(5),GETDATE(),
114)
) extr_date
,'ACTUAL' scenario
,CONVERT(CHAR(11),iu.month
,111) month_date
FROM
CUBEDATA..CUBE_DATA.INVENT
ORY_UPLOAD
AS iu
,CUBEDATA..CUBE_DATA.DATA_
SOURCES AS ds
,SMARTALLOCS..SMART_ALLOCS
.TST_APAC_
CCENTRE_RE
G_CODES AS vapaccc
WHERE
iu.cost_centre_code = vapaccc.cost_centre_code
AND iu.source_id = ds.source_id
when i select just using select * from VW_INV_CO_APAC_EXTRACTION , i am getting header in export file, but when i am using where condition in bcp query for example SELECT * FROM VW_INV_CO_APAC_EXTRACTION WHERE month_Date = '01 Jul 2007'
i am not getting header..
plz help me out on this
Thx
Naren
Start Free Trial