Solved

Sqlbullkcopy to temp Table in SQL

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Getting multiple values from a dataset ASP.NET(VB) 3 37
Angular JS Route 3 45
Connection String 16 43
Help with C#, MVC, razor. 6 21
In this article I will describe the Backup & Restore 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.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

911 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

20 Experts available now in Live!

Get 1:1 Help Now