473,835 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stored Procedure With Bulk Insert Not Working

88 New Member
I am using SQL Server 2005 and SQL Server Management Studio Express.

I'm new to stored procedures and I was creating this one to test out the BULK INSERT sql command. When I execute it says "Command(s) Completed Successfully" but when I open the table there are no records in it. The csv file has two rows in it. The first one is the column names and the second one is the only record in the csv file. So I am looking for one record to show up in my table after executing this but none are being inserted, and I get no errors, any ideas?

Here is my Stored Procedure

Expand|Select|Wrap|Line Numbers
  1. USE [Website_Administration]
  2. GO
  3. /****** Object:  StoredProcedure [dbo].[ps_Subscription_Import]    Script Date: 01/07/2008 11:55:25 ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER on
  7. GO
  8. -- =============================================
  9. -- Author:        Franccesca Baker
  10. -- Create date:           01/07/2008
  11. -- Description:    Testing Bulk Import
  12. -- =============================================
  13. ALTER PROCEDURE [dbo].[ps_Subscription_Import] 
  14.  
  15. AS
  16. --Build BULK INSERT Statement
  17. DECLARE @SQL varchar(2000)
  18.  
  19. BEGIN
  20.     SET NOCOUNT ON
  21.  
  22.     SET @SQL = 'BULK INSERT Subscription_Requests FROM "D:\DATA\Test\TestingBulkImport.csv" WITH (FIELDTERMINATOR = ",") '
  23.  
  24. END
  25. Exec(@SQL)
  26. GO
Jan 7 '08 #1
2 10143
iburyak
1,017 Recognized Expert Top Contributor
Is this D drive on your local machine or a server?
Did you try executing the same command from SQL Query Analyzer?
Jan 8 '08 #2
fperri
88 New Member
Is this D drive on your local machine or a server?
Did you try executing the same command from SQL Query Analyzer?
The D drive is on the server, and I am running it from SQL Server management studio express. Yes I tried to run just the SQL command and this is what I get


Msg 4863, Level 16, State 1, Line 1
Bulk insert data conversion error (truncation) for row 1, column 16 (PONumber).

(0 row(s) affected)

(0 row(s) affected)


I think its because it can't figure out that the line is ending. Column 16 is the last column.
Jan 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
12134
by: iqbal | last post by:
Hi all, We have an application through which we are bulk inserting rows into a view. The definition of the view is such that it selects columns from a table on a remote server. I have added the servers using sp_addlinkedserver on both database servers. When I call the Commit API of oledb I get the following error: Error state: 1, Severity: 19, Server: TST-PROC22, Line#: 1, msg:
6
2810
by: fumanchu | last post by:
I've got to let end users (really just one person) load billing batch files into a third party app table. They need to specify the billing cycle name, the batch name, and the input file name and then I can use these values to execute a SQL Server stored procedure to load them into the batch table from the input file (the stored procedure uses Dynamic SQL to Bulk Insert the file to a temp table then processes it into the final table.) My...
4
23561
by: Richard G | last post by:
I'm a database guy, so go easy on me here. :) How can I get the rowcount of the affected rows of a SQL statement from a stored procedure call? I know that "set nocount on" does not return the number of affected rows to the client, so I would assume that "set nocount off" sends the number of affected rows to the client, and therefore, is available programatically. If so, how to get that rowcount? Thanks, Richard
23
1943
by: Bonj | last post by:
Hi I'm looking to write an extended stored procedure, the job of which will basically to read data from one table, process it using a COM object, and write (insert) rows out to another table. I don't really know where to start with finding the functions necessary to read from an existing table. Can anyone be so kind as to point me in the right direction? Thanks very much
4
1524
by: nicholas | last post by:
Could someone tell me how to implement an INSERT on an aspx-page using a stored procedure, in VB-code? THX, Nic PS: I have been trying this, but it ain't working: Sub insert_new_content (sender As Object, e As EventArgs)
5
5364
by: wpellett | last post by:
I can not get the SQL compiler to rewrite my SQL UPDATE statement to include columns being SET in a Stored Procedure being called from a BEFORE UPDATE trigger. Example: create table schema1.emp ( fname varchar(15) not null, lname varchar(15) not null, dob date,
10
2945
by: J. S. EDV | last post by:
Hello, I have got a little problem with stored procedures and C#. I have got a stored procedure which should only insert something in a table. For example: ALTER PROCEDURE DBO.PROC1 AS insert into dbo.Test values ('test')
4
4365
by: scparker | last post by:
Hello, We have a stored procedure that does a basic insert of values. I am then able to retrieve the ID number created for this new record. We are currently using ASP.NET 2.0 and use N-Tier Architecture. The Stored Procedures are used through TableAdaptors, which in turn are used by Class Files. I wish to be able to return this new ID value using the Stored
12
5146
by: Dooza | last post by:
I have a stored procedure that takes a number of inputs, does a bulk insert, and then outputs a recordset. When I run the stored procedure in Server Management Studio I also get a return value from the stored procedure which is an INT. I want to access this return value on my ASP/VBScript page, but do not know how to access it. Here is my code so far:
0
9652
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10520
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10233
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9344
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7766
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6963
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5804
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4433
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.