How do I move data from one table to another using asp.net and MS SQL?

Thread Solved

Join Date: May 2009
Posts: 40
Reputation: phoenix_dwarf is an unknown quantity at this point 
Solved Threads: 0
phoenix_dwarf phoenix_dwarf is offline Offline
Light Poster

How do I move data from one table to another using asp.net and MS SQL?

 
0
  #1
Oct 24th, 2009
Hi,

I'm trying to move "leftover" data from one database table to another after the user clicked on a button. Please can anyone give me some advise. This is kinda really urgent plz.

Everytime i run my app it gives no error but also doesn't move my data.
I'm using a stored procedure and this is my code:

  1. ALTER PROCEDURE dbo.MoveDeleteUplHis
  2. /*
  3. (
  4. @parameter1 int = 5,
  5. @parameter2 datatype OUTPUT
  6. )
  7. */
  8. @tel text
  9. AS
  10. SET IDENTITY_INSERT CompanyHistory ON
  11. INSERT INTO CompanyHistory (CH_ID, CH_Tel, CH_SDT, CH_Duration, CH_Transaction, CH_Destination, CH_Amount, CH_Roaming, CH_Discount, CH_Status)
  12. SELECT Upl_ID, Upl_Tel, Upl_SDT, Upl_Duration, Upl_Transaction, Upl_Destination, Upl_Amount, Upl_Roaming, Upl_Discount, Upl_Status
  13. FROM Upload WHERE Upl_Tel LIKE @tel;
  14. SET IDENTITY_INSERT CompanyHistory ON
  15.  
  16. DELETE FROM Upload WHERE Upl_Tel LIKE @tel;
  17.  
  18. /* SET NOCOUNT ON */
  19. RETURN
Last edited by phoenix_dwarf; Oct 24th, 2009 at 11:38 am. Reason: Missing code
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 40
Reputation: phoenix_dwarf is an unknown quantity at this point 
Solved Threads: 0
phoenix_dwarf phoenix_dwarf is offline Offline
Light Poster
 
0
  #2
Oct 24th, 2009
Well I saw now that if i take out "WHERE Upl_Tel LIKE @tel" it works but now it also moves the data that i dont want moved??? Any ideas...
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 40
Reputation: phoenix_dwarf is an unknown quantity at this point 
Solved Threads: 0
phoenix_dwarf phoenix_dwarf is offline Offline
Light Poster
 
0
  #3
Oct 27th, 2009
NVM! I found out this code works 100% perfectly...my bad! (I converted a string to an int and so lost some zero values and that was my problem) tnx anyway!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 403 | Replies: 2
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC