Solved

Sqlbullkcopy to temp Table in SQL

Posted on 2011-09-22
4
375 Views
Last Modified: 2012-05-12
I will be implementing a module in Web based app where i need to copy the data from Excel file to SQL Server 2005 DB. I will be using SQLBulkCopy class to copy the data to server. I don't want to use any physical tables in SQL , instead i want to use a Temp table created from stored proc.Is it possible to copy the data by using SQLBulkCopy's WriteToServer method to a Temporary table (#Temp) created from a stored procedure before calling the WriteToServer method of sqlbulk copy ?? Can any one post a sample code for the same..? Any help would be grateful.
0
Comment
Question by:dprasannain
4 Comments
 
LVL 5

Accepted Solution

by:
zvytas earned 250 total points
ID: 36581318
Yes you can do it:

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.destinationtablename.aspx

You can bulk-copy data to a temporary table by using a value such as tempdb..#table or tempdb.<owner>.#table for the DestinationTableName property.

However, temp table will have to be created in the context of the same connection used by SQLBulkCopy.
0
 

Author Comment

by:dprasannain
ID: 36581656
Thanks zvytas: let me implement that , will let u know the status on that.
0
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 37932301
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question