473,387 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Stored Procedure With Bulk Insert Not Working

88
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 10119
iburyak
1,017 Expert 512MB
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
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
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...
6
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...
4
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...
23
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...
4
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...
5
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...
10
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...
4
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...
12
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.