Solved

Sqlbullkcopy to temp Table in SQL

Posted on 2011-09-22
4
364 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now