CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS MICROSOFT ADO.NET DETAILS
Question :
How to copy the contents from one table to another table and how to delete the source table in ado.net?


Category ADO.NET Interview Questions
Rating (2.7) By 7 users
Added on 7/27/2006
Views 1662
Rate it!
Answers:

May be there is a better way, but you can generating a datatable from source and load it to destination if the process is successful, execute the drop table query.



SELECT * INTO newTable FROM oldTable.

This will copy the table structure and data in it

If you require the structure of the table one[i.e. no data] then

SELECT * INTO newTable FROM oldTable WHERE 0 = 1



 Posted by: Kanhaiya Prasad    

Contact Kanhaiya Prasad  Contact Kanhaiya Prasad

Use SQLBulkCopy to do bulk data transfer from one table to another. SQLBulkCopy object is specially developed for such purposes.

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



 Posted by: Pavan    

Contact Pavan  Contact Pavan

u can copy the table in to another table using "into" and then execute the "drop" command



 Posted by: Anusha    

Contact Anusha  Contact Anusha

By using SqlBulkCopy. use WriteToServer() method to write to desto table.
*** but make sure that table with same schema that of src is created*** else its throws excepton



 Posted by: Srikanth    

Contact Srikanth  Contact Srikanth


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
How to find the given query is optimised one or not?

View Answer
What is the execution procedure in oracle ?

View Answer
Can we connect two datareader to same data source using single connection at same time?

View Answer
Why can't we use Multiple inheritance and garbage collector paralelly in .net

View Answer
How many records can take clustured index in sql server




View Answer
Difference between SqlCommand and SqlCommandBuilder

View Answer
Why edit is not possible in repeater??

View Answer
What is the difference between data reader & data set




View Answer
How can we load multiple tables in to Dataset?

View Answer
Does SQLClient and OLEdb class share the same functionality

View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL ADO.NET Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/8577/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.72