Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sqlbullkcopy to temp Table in SQL

Posted on 2011-09-22
4
Medium Priority
?
413 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 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

885 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