Solved

Sqlbullkcopy to temp Table in SQL

Posted on 2011-09-22
4
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

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!
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

622 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