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

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

SQL BULK INSERT, WITH FORMAT FILE and Hyperterminal file

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :

Hello, I have a SQL Table, into which I am attempting to do a Bulk Insert With FormatFile.  I have SQL Server 2005, and a hyperterminal output from our phone system (PartnerMail).  I can't seem to get this to work ... Not Sure how to deal with the "Sometimes-there's-a-Double" time at the end ... And not sure of the 'MaxBytes' value (the second zero) ...

I keep getting one of two error messages, depending on what I mess with: 

Msg 8152, Level 16, State 14, Line 1

String or binary data would be truncated.

The statement has been terminated.


Msg 4832, Level 16, State 1, Line 1

Bulk load: An unexpected end of file was encountered in the data file.

Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.

Msg 7330, Level 16, State 2, Line 1

Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

Any suggestions?


View Complete Post

More Related Resource Links

Inside Windows: An In-Depth Look into the Win32 Portable Executable File Format, Part 2


The Win32 Portable Executable File Format (PE) was designed to be a standard executable format for use on all versions of the operating systems on all supported processors. Since its introduction, the PE format has undergone incremental changes, and the introduction of 64-bit Windows has required a few more. Part 1 of this series presented an overview and covered RVAs, the data directory, and the headers. This month in Part 2 the various sections of the executable are explored. The discussion includes the exports section, export forwarding, binding, and delayloading. The debug directory, thread local storage, and the resources sections are also covered.

Matt Pietrek

MSDN Magazine March 2002

Inside Windows: An In-Depth Look into the Win32 Portable Executable File Format


A good understanding of the Portable Executable (PE) file format leads to a good understanding of the operating system. If you know what's in your DLLs and EXEs, you'll be a more knowledgeable programmer. This article, the first of a two-part series, looks at the changes to the PE format that have occurred over the last few years, along with an overview of the format itself. After this update, the author discusses how the PE format fits into applications written for .NET, PE file sections, RVAs, the DataDirectory, and the importing of functions. An appendix includes lists of the relevant image header structures and their descriptions.

Matt Pietrek

MSDN Magazine February 2002

Insert into SQL Server with ajax file uploader


I am getting error in here 


Incorrect syntax near '987'

987 is where i put clientname.text

        Dim objCmd As New SqlCommand("Create Table " + clientname.Text + "(name Varchar(50), event Varchar(50), date1 datetime, username Varchar(50), password Varchar(50), " + strCommandText + ")", objConn)

        objCmd.CommandType = CommandType.Text

        Dim objConn2 As New SqlConnection("Data Source=dddd.db.2.hostedresource.com; Initial Catalog=mrpoteat; User ID=xxxxx; Password=xxxxxx;")
        Dim strCommandText2 As String = ""
        For index2 = 1 To Attachments1.Items.Count Step 1
            If String.IsNullOrEmpty(strCommandText2) Then
                strCommandText = "@pic" + index2.ToString()

Insert image into Infopath form and save to SharePoint as PDF file


I have an InfoPath web-enabled form in MOSS 2007, that is integrated with a K2 blackpoint process for an approval workflow.

Once the form (a Purchase Order request form) has been approved in the K2 workflow process, I switch the form view to a "print-friendly" view for the requestor to view from the browser.  However, now I need to go one step further with this scenario:

1) I need to somehow insert/embed an image with the scanned-in signature of the approver (likely stored in a SP doc library) at the signature line section of my form.  Also, what are the security requirements for storing such images, but not granting all users access to these (e.g. only services accounts that need to access this for embedding into the form, etc.)?

2) Then I need to convert this final "print-friendly" view of the form (with the signature image) to a PDF document so that I can store it in SharePoint (and email it to the requestor using K2's email event capabilities).

Can anyone help me with a solution to both of these requirement, or point me to some resources for this (even 3rd party components are open-game).



Insert Excel Data via File Upload into sql server database???

Hi all, I have requirement that User can Upload the Excel Sheet Data to sql server Database at once. How i do that Any Article or hint is apperciated.   Regards 

Howto set the value of webgridcolumn.format in the class file?

About:  I want to define format string of the webgridcolumn by myself.Example:There is a ID column in a webgrid ,i want the cell of this column filled the data like "<a href="/Default/@ID">@ID</a>"Code: Microsoft.WebPages.Helpers.WebGrid mygrid = new Microsoft.WebPages.Helpers.WebGrid(tarobjs,canPage:Convert.ToBoolean(data.Groups["enablepager"].Value), rowsPerPage: Convert.ToInt32(data.Groups["pagesize"].Value));                 Microsoft.WebPages.Helpers.WebGridColumn[] columns = new Microsoft.WebPages.Helpers.WebGridColumn[data.Groups["col"].Captures.Count];                                 for (int i = 0; i < columns.Length; i++ )                 {                     columns[i] = mygrid.Column(columnName: data.Groups["col"].Captures[i].Value, header: data.Groups["headertitle"].Captures[i].Value);                                      }                 HtmlString myhtml = (HtmlString)mygrid.GetHtml(columns:colu

snp file retains format of default printer from which it was created

This seems to be the case: MS Access 2000/2003 generates a snp report via VBA (Windows 2000/XP is the general environment for the enterprise).  The report is emailed to another individual.  When the recipient tries to print the report the print options apparently force the print job into the printer's override tray as "Print to Heavy Paper"; thereby causing the printer to wait for a user to place paper into the override tray (the printer is in use by a number of users). This anomaly does not happen with snp reports sent from other users, only from the two who are using one particular printer as their default printer.  As this relates to a remote customer, I have not so far requested the [affecting] sender users try using a different printer.  Either way it causes someone to perform extra steps -- Sender: if the printer selection was to be changed each time a snp report is created; Recipient: each time they need to print the particular report they need to go into printer options and override the Heavy Paper issue by selecting letter paper (and always be alert that the particular report came from the two particular sender users -- whereas once the recipient user sends the print job, it's too late; they need to run over to the printer to insert paper into the override tray to avoid a backlog of printer jobs). The site's IS team has bee

Unable to export data to an excel file in grid format!!!

I'm exporting data to an excel sheet from the ojects list. The data is exporting to excel sheet well, but I'm unable to see the grid format for the data. The data is looking with out the rows and columns lines. I think I'm missing to set some property or somethnig ehwn exporting.   Any help would be really appriciated.

Insert Into SQL Server, With Current File Uploader Count

I have a Multiple File Uploader named "Attachments1" , and to get the cound I used "Attachments1.items.count"... then I have a Insert Into Command for SQL Server, that Inserts information into the table for every item in "Attachments1", you can see the below code... For Each item As AttachmentItem In Attachments1.Items             Dim objConn2 As New SqlConnection("Data Source=XXX")             objConn2.Open()             Dim objCmd2 As New SqlCommand("INSERT INTO clientport (name, event, phone, email, date1, password, path, path2, filename, number)" & "VALUES (@name, @event, @phone, @email, @date1, @password, @path, @path2, @filename, @number)", objConn2) But for the "number" Column, I would like to insert the Count for that file... For example if Attachments1 has 3 files it will insert into the database the time (which works fine)  the probem is the number column doesnt make file1 for the first file, file 2 for the second file, and file3 for the third file... Instead it puts file3 for all three rows when it Inserts into the DB.  my code is below to get the count.   Dim strcommandtext As String = ""    

How can we insert csv file data into Sql server table based on some condition ?


Hello All experts there,


I need to insert some csv file data into sql server 2008. but there are multiple tables created in sql server and I need to check some conditions before data insertion and based on the condition value, sql script should insert the data in to specific table. in other words I need to insert data from one csv file to different tables based on some condition.

is it possible? if yes then can anyone please give me an idea on how can we do that?


Thanks in advance


Nipendra Garg




<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
WIDTH="550" HEIGHT="400" id="myMovieName">
<PARAM NAME=movie VALUE="myFlashMovie.swf">
<PARAM NAME=quality VALUE=high>
<EMBED src="/support/flash/ts/documents/myFlashMovie.swf" quality=high bgcolor=#FFFFFF WIDTH="550" HEIGHT="400"
NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"


XML File Format...


XML structure:


i have try to made quiz application using xml file

Requirement of Quiz:
1)question id
3)answers (radio button or checkbox)
6)next question where to go...?

my xml flie : sample.xml

suppose start application:
 show question id:1
 Show question   :what is your name?
 Show answers RB :1)Jhon
show flags:
           flag depends on section of answer mode if select 3)Lina show flag :Manager

if select other answer thete is no flags .

note shows:
        Note also depend on answer selction mode if select 4)ron do not showw flag show only note: i will add position.        

if select other answer thete is no Note.

next question:
        next question is also depend on answer if selct answer 1)jhon then go to directly question no. 5

Insert Data to table from excel file


guys, i am new to sql development

my question is how do i import data from an excel table,

i was trying to do it via a query and just paste the values, but received a syntax error. thanks

data structure is:


how to insert a path file into an array and listview using openfiledialog with multiselect property?



i have problem to insert path file into an array and listview(detail) using open file dialog wit multiselect property, please give me sample to make it?

SQL XML Bulk Insert 3 tables format issue


I would like to ask for you help finding a problem in my XML schema.  I need to do a bulk insert into 3 tables that are linked.  I have an address, site and customer table. It is an SQL Server 2008 Database


The customer table links to its address in the address table.  The Address table contains no links to other tables and the site table contains a link to the customer and to the sites address.

From my understanding of this bulk insert procedure, I need to insert my address for my customer then my customer with a link to its address.  Then I want to insert my sites for my customer but they need their addresses too so I want to insert the site address and then the site with the key relationships to its address and customer row in those tables.

The xsd file is below that I have at the moment:

<?xml version="1.0" encoding="utf-8"

Insert spaces to get fixed length fields for flat file export



I have a query which extracts all the required data from a database and I need to load this data into a Text File. I am using a SSIS package to do this.

Now this file should have data in the format given below

437856785        A20101009This is construction         124728347

i.e the receiving file has no delimiters and each field is determined with a fixed length(fixed number of characters). The data I get out of my query for example for the first column returns just the value 437856785 and I need to append spaces to it to achieve the fixed length. I need to do to this kind of appending spaces to all the columns. Please suggest me ways to do this.

Thanks in advance..



Format File


Dear buddies,

I need to create a format file for many of my tables in SQL Server.

My objective is to create a fixed length text file. 

Could someone please guide me.


I am reading through msdn's docs on format file but I couldn't grasp it. Can I use bcp to create this? I will have to repeat this for many more tables.


Please guide me.


Thanks in advance.

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