Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 joegrant55
		
			joegrant55
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
I have created a table that stores multiple fields into a txt file.
I need to add a 'header row' above the current fields as this txt file is loaded into a system that uses the header row as an indication of what to do with the file. My delimiter is '|'.
Example:
Header1|Header2|Header3|Header4
Field1|Field2|Field3|Field4|Field5|Field6|Field7|Field8|Field9|Field10
Does anyone know how I add a header row in the script?
Thanks,
Joe
 kaushiknsolanki
		
			kaushiknsolanki
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
How are you storing this table in txt file?
 joegrant55
		
			joegrant55
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Like so:
TableExample:
LOAD
FIELD1
FIELD2
FIELD3 etc.
From source
Store TableExample into TableExample.txt(txt);
 joegrant55
		
			joegrant55
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Apologies the store part is like so:
Store TableExample into TableExample.txt (txt, delimiter is '|');
 kaushiknsolanki
		
			kaushiknsolanki
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
You should give delimiter like below and it should work.
Store [TableName] into [Path]\[FileName].Txt(txt, delimiter is '|');
 kaushiknsolanki
		
			kaushiknsolanki
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
When i performed the same thing, I could see the headers (Field Name) in the file.
Dont you see them?
 joegrant55
		
			joegrant55
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
Yes I see them but as per my example I need another row above the field name headers made up of different names.
Header1|Header2|Header3|Header4
FieldName1|FieldName2|FieldName3|FieldName4|FieldName5|FieldName6|FieldName7
I have attached a txt document example also.
Thanks,
Joe
 kaushiknsolanki
		
			kaushiknsolanki
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		What is the source of the table?
Is it Excel or database table?
 joegrant55
		
			joegrant55
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		It has been created using multiple qvds and xlsx and then stored as a csv.
This csv. is then loaded, edited and saved as a txt file.
 kaushiknsolanki
		
			kaushiknsolanki
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		You can do one thing.
Store that data in a temporary text file, similar to what you are doing currently.
Store [TableName] into [Path]\[FileName].Txt(txt, delimiter is '|');
Now write the load script to load this txt file (Newly created one in above step).
Your load statement should look like below.
Data:
LOAD @1 as Header1,
@2 as Header2,
@3 as Header3,
@4 as Header4
FROM
Path\Filename
(txt, codepage is 1252, no labels, delimiter is '|', msq);
And store this using normal Store command.
