944,181 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Marked Solved
  • Views: 939
  • ASP.NET RSS
Oct 24th, 2009
0

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

Expand Post »
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:

ASP.NET Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
phoenix_dwarf is offline Offline
57 posts
since May 2009
Oct 24th, 2009
0
Re: How do I move data from one table to another using asp.net and MS SQL?
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...
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
phoenix_dwarf is offline Offline
57 posts
since May 2009
Oct 27th, 2009
0
Re: How do I move data from one table to another using asp.net and MS SQL?
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!
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
phoenix_dwarf is offline Offline
57 posts
since May 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC