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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Data loading from text file

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :Sql Server
Hi, I am loading the data from a flat file into a sql table. The values in one of the column have spaces at the end of the value. I want to remove those spaces and load into the table. I am thinking of using derived column and use rtrim on that column, how can I use that as an expression. Thanks.sqldev

View Complete Post

More Related Resource Links

saving a text file in ms access data base

i have to read a text file in a text box then have to save it into ms access data base in column format how could i do this....

Unable to load data from txt file with text delimiter specified, if the data has the same character


Have come across a strange scenario and seeking your ideas/thoughts.

I'm using a ssis package to load a txt file. The txt file is text delimited by double quote (") and column delimited by tilde (~). It works fine in most scenarios and strips the enclosing "" from the columns -no problems there. However, in a specific scenario where the last column has double quote in the data as well being the text delimiter, the package throws the following exception indicating that it's missing a column delimiter

 The column delimiter for column "COL_NAME" was not found

This behaviour was not observed when double quotes were present as data in any other column in the file. Was able to workaround by disabled text delimiter only for the last column, but that isn't a perm solution. Also observed that if the " was replaced by escape sequence /" the file loaded successfully. Wondering if this a known issue ?


Some problem in Data Flow while upload a "||" seperated text file


I am facing one problem with sql 2005 SSIS while uploading a "||" seperated text file with Data Flow in SSIS.Below I am giving the sample data of the text file



When I uploaded it using sql 2000 DTS it was not giving and it was being uploaded into the table but when I tried with SQL 2005 it is giving the below problem.

"[Flat File Source [1]] Error: Data conversion failed. The data conversion for column "Column 2" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.". "



How to output data from master detail tables into text file but on different lines.



I have a requirement to output data from two tables, a master table and a detail table, to a text file such that the output looks like the following:

master record 1

detail record  1 1

detail record   1 2

master record 2

detail record  2 1

master record 3

detail record 3 1

detail record 3 2

detail record 3 3



Is this possible in one query?  I am sufficiently familiar with the bcp utility to do the output from any of the tables separately but have some difficulty with doing it for the two tables and have the result structured as outlined above.

How to connect text file data to native SharePoint lists with auto update?


I have to pull external data from a text file to a SharePoint list on a daily base. Additional column content (e.g. attachments) in SharePoint should be kept during update. There should be RSS feeds, email notifications or workflows on external data change (so delete all items and import new will not work).

I've found this codeless 3rd party solution with automatic background update (and write-back???):

Any other idea? BDC-based? Thanks.

Thanks, SharePointFrank http://www.layer2.de/en/products/

Upload Text File data to SQL table Using SSIS

I have a text File with following format  (  HED - Header Row, CL-Data (Sample 3 Rows) , TRL-Trailer Row)


CL 012352908607309000014090 2010-03-04 16:12:53.077000000 Inserted / Log ICode Action on Order Number / 33949591 / with / I-Code / IDEC/ / Memo: / cci questions about alert/

CL 012352958107309000020378 2010-04-14 10:20:03.340000000 Inserted / Log ICode Action on Order Number / 36992594 / with / I-Code / ISRB,INEW,ILKD/ / Memo: / cci to cxl, saved with benefits and gave her instructions to move account online/

CL 012353013807309000021681 2009-11-24 17:09:05.973000000 Inserted / Log Customer Info Change Action CL 012353013807309000021681 2009-11-24 17:09:05.973000000 Updated / Log Customer Info Change Action

TRL201008240001PCMCL 0000007349

I have to Import The above Mentioned data in to Following Table

CREATE TABLE [dbo].[Log]

[Type] [varchar

Loading rtf with image gives "Unrecognized structure in data format 'Rich Text Format'.\r\nParamet


I'm trying to load this rtf into a RichTextBox:

{\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 Segoe UI;}}{\colortbl\red0\green0\blue0;\red255\green255\blue255;}\loch\hich\dbch\pard\plain\ltrpar\itap0{\lang1033\fs18\f2\cf0 \cf0\ql{\f2 {\ltrch >> -----------------------------------------------------}{\ltrch \line }{\ltrch >> 19-10-2010 11:22}{\ltrch \line }{\ltrch >> -----------------------------------------------------}{\ltrch \line }\li0\ri0\sa0\sb0\fi0\ql\par}
{\f2 {\ltrch {\*\shppict{\pict\picwgoal1020\pichgoal1035\pngblip

How do I create an XML file from a text file containing simple ascii data? Put another way, how do I


Im trying to take a text file I downloaded from the US Census Bureau website and transform it into an XML file. It is what the Census Bureau calls a ZCTA file. The schema of the file I have reposted as follows:

ZCTA File Record Layout

The ZCTA file contains data for all 5 digit ZCTAs in the 50 states, District of Columbia and Puerto Rico as of Census 2000. The file is plain ASCII text, one line per record.

  • Columns 1-2: United States Postal Service State Abbreviation
  • Columns 3-66: Name (e.g. 35004 5-Digit ZCTA - there are no post office names)
  • Columns 67-75: Total Population (2000)
  • Columns 76-84: Total Housing Units (2000)
  • Columns 85-98: Land Area (square meters) - Created for statistical purposes only.
  • Columns 99-112: Water Area (square meters) - Created for statistical purposes only.
  • Columns 113-124: Land Area (square miles) - Created for statistical purposes only.
  • Columns 125-136: Water Area (square miles) - Created for statistical purposes only.
  • Columns 137-146: Latitude (decimal degrees) First character is blank or "-" denoting North or South latitude respectively

Columns 147-157: Longitude (decimal degrees) First character is blank or "-" denoting East or West longitude respectively

All I want to do is produce an XML file with t

Problem Loading Data from Excel file


hi all

i am loading Data From one my Excel file to DataTable. My Excel file has data in Following Format:

Vendor ID Invoice Number Invoice Date  Entity Invoice Amount
Remarks GL Account
5586   e5500222117 5/14/10  Entiti1                       3.000
some 210000
5586   5500231216 6/11/10  Entiti1                       4.000
hello 210000

SqlBulkCopy How to Use to Insert Data From text CSV file to Sql Table



I am New to using the  SqlBulkCopy Can any one tell me how to use it and how many rows maximum we can insert using the SqlBulkCopy

how to habdle the  exceptions when bulkcopy inserting

Create a zedgraph by using the data from a text file

I'm new to zedGraph and based on i need to retrive the data from EC.txt file to form a zedgraph.
        private void graphButton_Click(object sender, EventArgs e)
            Graph energyGraph = new Graph();
            GraphPane myPane = energyGraph.zedGraphControl1.GraphPane;
            myPane.Title.Text = "Graph ";
            myPane.XAxis.Title.Text = "Number of S";
            myPane.YAxis.Title.Text = "EC";
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 15;
            myPane.YAxis.Scale.Min = 0;
            myPane.YAxis.Scale.Max = 100;
            PointPairList list1 = new PointPairList();
            objStream = new StreamReader("

Exporting encrypted data to a text file


Hi All,


I have a table with one coumn encrypted using SQL encryption. What i need to do is extract this data, encrypted but in a readable format (in the table, the encrypted data looks like asian characters), and send it off to a vendor who will then import and decrypt the data. I've worked through the requirements of db master key/certificate and symmetric key being the same on both our end and the vendor's end.

But i cannot generate a text file properly. I use the import/export wizard and select 'unicode' and when i do a preview i can see the encrypted data string. After i generate the txt file, and load it into my new test database, apply the same db master key/certificate and symmetric key, and then try to decrypt the data, the clumn shows NULL values.

Can someone help out with what im doing wrong in the file generation? Should i be using import/export wizard or something else like bcp?

Thanks in advance

Need Oracle Data Provider .CS File for Oracle 10g Database connection !



I need a 'Wrapper.cs' file which takes care of the Database connection ( Oracle 10g) where

i can just call the method with my SQL Query


Gridview1.DataSource = SampleWrapper.ExecuteDatatable("THE SQL QUERY");


Plz Post the link if there is any open source !    

convert SQL data to EDI 835 file


I was assigned to create a app to convert SQL data to EDI 835 file. (Electronic Data Interchange file for Health Care Claim Payment/Advice,  outbound process only).

Can someone help me where to start?

Writing to a text file



I have the following  subroutine in an asp.net application class. The subroutine writes data to a text file upon application login.   My question is that if this function was called at the same time by two different  users would it cause any kind of error. Is there a need for a try catch?

 Public Shared Sub writeToLogFile(ByVal UserName  As String)
        Dim strLogMessage As String = String.Empty
        Dim strLogFile As String = System.Web.HttpContext.Current.Server.MapPath("~/Log.txt") Dim swLog As StreamWriter
        strLogMessage = DateTime.Now.ToShortDateString().ToString()  " ==> " & UserName

        If Not File.Exists(strLogFile) Then
            swLog = New StreamWriter(strLogFile)
            swLog = File.AppendText(strLogFile)
        End If


evaluate data in row and change text on asp:ButtonField accordingly.


I am building a website for my hockey league.


I have a gridview that displays the current weeks scheduled games. Ideally I have added a column to the end of the gridview that I would like display 1 of 3 values. If the game has already been played I would like to display the score of the game; if the game has yet to be played I would like the column blank and if someone on either team has indicated that they can't make the game I would like to display a button that says "subs needed" and take you to another page to sign up to be a sub. Can this be done? I have been able to change the background color of the line based on the two boolean flags from the database using the RowDataBound event handler but I can't seem to find a way to set the value of a specific field in my row. (The background is set for the whole row.)

Thanks in advance -eric

The file reached the maximum download limit. Check that the full text of the document can be meaning



I'm facing an issue with the indexing.

I have 1 WFE+Index server+DB server.

Index server is not installed with MS FIlter pack 1.0

When crawling, the there will be document with warning in crawl log:
The file reached the maximum download limit. Check that the full text of the document can be meaningfully crawled.

Documents that with warning are such as doc, ppt, xls, docs, ppts and many others.
However, I view into the successful crawled document, there are doucments with ext doc and ppt.

For large file index, there are MaxGrowthFactor + MaxDownLoadSize required to be added into the index server.

As my understanding is, MS Filter Pack should installed into index server(already did, correct me if i'm wrong).

I looked into the Office SharePoint Seach(CA>Services in farm), if the server is appointed to "Use this server as indexing server", then MS Filter Pack is suppose to be installed into that particular server as well.

At the bottom, there also has another option is "Use all web front end for crawling".

The question here is, IF the option "Use all web front end for crawling" is selected.
Does the WED FRONT END Server required to installed the Ms Filte

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