.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Post New Web Links

Non Delimited Header in a delimited output file

Posted By:      Posted Date: October 06, 2010    Points: 0   Category :Sql Server


I have a requirement to make a delimited flat file from a data base table.  The table has some 20+ columns.   I totally understand how to accomplish this part.  What is a bit more  tricky is that I need to create a header row that is not delimited.  The final output would look something like this


$header –Opt1 –Opt2 20101005


View Complete Post

More Related Resource Links

Comma-Delimited Output

One of the common tasks performed when retrieving data from a SQL Server database is returning the result as a comma-delimited output instead of a result set. This task can be performed by using a CURSOR selecting the column to be concatenated together. Each row returned by the CURSOR is then concatenated together into a variable separating each one by a comma.

SQL Agent Jobstep output file contains automatically generated header

Hi,   I've created a stored procedure that creates a script to create a number of objects within the database (based on what existing objects are in the database).  From Management Studio, this works fine, and the output is exactly as I want it.   I'm now trying to create a job that will execute this stored procedure, and deposit the results into a file somewhere on the server.  When the job runs, the script is created in the correct place and is essentially ok.   However, there are a couple of questions I'd like to ask.   Why does SQL Server Agent put a header at the top of the output file?  I was hoping to be able to use that output file 'as is' and execute it automatically to recreate my objects when required.  (Obviously, I can manually remove the header, but this is an inconvenience in this situation).  How do I stop it?   Also, when executed from SSMS, the output is correctly line-spaced.  But, the output from the scheduled job adds an extra line between each line of text, which is, again, inconvenient.  Why does it do this, and how can I prevent this (again, without manually editting the output)?   Any thoughts and help greatly appreciated.   Cheers Simon

How to save form data to delimited file?

I tried searching, but maybe I was putting in bad keywords =\How do I go about saving form data into a delimited file?

Sql Server 2005 ( remove header information from query output file "Job 'bustd_Daily_Query_Output_1

Dear All,I have scheduled job for querying output & asve it into particuler folder....but in the top of file i getting the message like "Job 'bustd_Daily_Query_Output_13July09' : Step 1, 'Query1' : Began Executing 2009-07-13 16:32:06"I want to remove this & want output in txt file format without above header....RegardsRavendra Cindia

how do i create a schema.ini file from a tab delimited file?

Hi there,How do I create a schema.ini file from a tab delimited file?I have this so far:[myFile.txt]ColNameHeader=TrueFormat=TabDelimitedCharacterSet=ANSII think I need something like this after my last line from above:Col1=first TEXT width 150My text file has 7 columns, the first row is the header row. The data comes from a Micosoft SQL Server Database where the fields are of the following types:intnvarchar(MAX)nvarchar(50)Many many thanks,Kiley

Ignore trailer record in delimited file

SSIS 2008 I receive flat data files from a vendor that are pipe delimited however there is a header row and a trailer row that is not pipe delimited.  The first row is easily bypassed however SSIS rightfully complains about the last row;  “There is a partial row at the end of the file”  Short of having a separate process to strip the trailer record is there a way for SSIS to ignore this row?  Currently I am using a simple data flow with a flat file source and a OLE DB destination (database) with the usual column mapping. I can ascertain the data rows from the trailer row by the first character.  Data rows start with ‘D’ and the trailer row starts with ‘T’.     Thanks for any help! RJ  

parsing tab delimited spanish characters file


Using vb.net/asp.net 2005.

another spanish character issue:  I am parsing special spanish characters, removing the tildes (EX:  "ñ" becomes "n") that customers send us in files, in tab delimited files that is.

When the characters are valid spanish characters (like "ñ") then this is not an issue, however some of the files that we get have characters such as:


Which should actually be:


Has anyone seen this and know any solution?  The "ñ" is fine but I am not certain what to do about the "±".

this is only one example, other spanish characters are listed as a question mark "?" so this is causing some issues.



How can I export my reports to tab delimited csv file?


How can I export my reports to tab delimited csv file?




While Exporting to CSV (XComma Delimited), Report Header and Footer will get Exported Or not


Hi All,

I have Below Report in 2005.


My Report

Reading Tab delimited xls file



I have tab delimited .xls file. I want read this to a dataset. Oledb connection string is given below. But i'm getting one error on objConn.Open();

string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties=Excel 8.0";

OleDbConnection objConn = new OleDbConnection(strConn);

Error : External table is not in the expected format.

How can i read tab delimited .xls file to a dataset using oledb connection?



export data to pipe delimited file



I am trying to export the sql script data to pipe delimited text file.

I did below steps

1. JOined the sql tables and wrote the sql script.
2. export the results to glbal temp table.
3. then BCP the results to pipe delimited text file.

here is the select query

Select dbo.FN_Decrypt(@master, Login.LoginSkey,PatientDisplayID) as 'Client ID', ISNULL(SugarEntryCount,0) as 'BG Count',
    ISNULL(CarbsEntryCount,0) as 'Carb Count', ISNULL(MedsEntryCount,0) as 'Med Count'
FROM #temp_patients inner join Login ON  Login.LoginID = #temp_patients.PatientID

EXECUTE master.dbo.xp_cmdshell 'bcp "SELECT * FROM ##PIPE_REPORT " queryout C:\Data\Objects.txt -t"|" -c -T '

DROP TABLE #temp_patients

I have successfully exported data into pipe delimited text file. but only data not the columns names

I need columns names inthe first row, please let me know how can i do this?

and also I need special characters enclosed in quotes. And how can I describe each column data type in text file? I will be having alphabets and numerics in text file.

Thank you


Tablix Header missing on last page of PDF output

Tablix Headers don't show on last page of PDF and TIFF output.   I've tried all things mentioned including installing SQL Server 2008 Cumulative Update# 7.   My issue is that I have a Tablix with some header rows that repeat fine until the last page.   On the last page they are hidden.  This appears to be true of PDF and TIFF output.  THere are other issues with Word output.   The standard HTML viewer works fine.   So its clearly a PDF renderer issue.  

FileStreamResult how to rename the output file?????

i have an action to return a pdf file in my controller,if the return file is for downloading, the following code can be used to modify filename successfully.HttpContext.Response.AddHeader("content-disposition", "attachment; filename=form.pdf");HOWEVER, i found that when the pdf file was returned to browser( rather than a pop up window to download), the filename always remain same as the action name! (when u right click file and try to save it on ur hard disk), i was wondering if there is a automatic way to rename the file rather than "right click" and "save as" manually.so  can anyone tell me how to rename the outputfile when it is shown in the browser?

customize list view table header css file

i need to make table header for my list to be red and on hover to get specific  image so all my site have the same appearence also i need this to reflect to the list view webpart thanks

FPT File Header (FoxPro)

Following is DBT File Header (Dbase DBF Memo Header) [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] private struct DBTHeader { public Int32 nextBlockID; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] reserved1; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] public string fileName; public byte version; // 0x03 = Version III, 0x00 = Version IV [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] reserved3; public Int16 blockLength; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 490)] public byte[] reserved4; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] private struct MemoHeader { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] reserved; public Int16 startPosition; public Int32 fieldLength; } i required FoxPro FPT File Header. Following link is description of  FPT File Header but i can not under stand how is it use in C#. http://www.clicketyclick.dk/databases/xbase/format/fpt.html Please Help Me. Thanks   Please "Mark as Answer" if this post answered your question. :) Kalpesh Chhatrala | Software Developer | Rajkot | India Kalpesh 's Blog

How do you freeze the tablix header row in an Excel export file in SSRS 2008?

So this is totally killing me. I've found out how to make a tablix header row repeat on each page of a PDF export file in SSRS 2008 (which I won't even get started on because all I can say is that 2005 is way better), but I cannot figure out how to make a simple header row of a tablix freeze in an Excel export file.  The tablix is right at the top of the body and spans the entire width of the design area.  How in the world do you get it to freeze in the Excel export file?

Output Blank Text File

Hello all,I have come across an interesting edge case when using Response.Write. I couldn't find another forum to post this in, so I'm putting it here, even though its not really "getting started" in my mind.The scenario goes like this:I have a ASPX page that stores data in a string using a comma delimited text format, which is then written to the response stream using Response.Write. Whenever there is data, this works fine. But, when there is no data, the string generated is empty and a basic HTML page structure magically appears in the output even though it isn't even in the .ASPX file. What I'd like to do is simply return a blank text file (not even a space).I've tried using Response.Clear to ensure that there is no content in the response stream. I've tried setting the content type and even specifying a filename in the response header. I am, of course, also using Response.End after the call to Response.Write, but all to no avail. The response is always a basic HTML structure.To eliminate other possibilities, I've set up a test. Just a default .ASPX Web form with the following PageLoad method: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.ContentType = "text/plain" Response.Clear() Response.Write("") Response.End() End Sub
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend