Click here to Skip to main content
15,790,243 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have two tables

1st for Tbl_Future
id, Product , Datetime

2nd for Tbl_Live
id , Product

there some product records with time in Tbl_Future

now i want to transfer that data when server time reaches to product time,
then at that time for that i want to transfer from Tbl_Future to Tbl_Live.....


jab jis product ka time server time jitna ho tab data Tbl_Future mese Tbl_Live me transfer ho.....

please help me.....
Orcun Iyigun 18-Jan-12 12:32pm    
It is a bascic insert statement and a date check. where do you have difficulty solving this problem?
manognya kota 19-Jan-12 0:19am    
Do you want to automate this process? like u have a data dump in the first table and when ever the time matches the table time, it should be inserted into the 2nd table?
PKriyshnA 19-Jan-12 1:03am    
ya i want automate this process....

Instead of two tables, why not just keep the one table and use a query something like
SELECT * FROM tblData WHERE DateTime < getdate(). Unless you have a very specific reason why to have redundant data in the system, that is the way I would go.
Share this answer
Ideally, I would go for the above solution but in some instances you would want a redundant data set. In this scenario,

What is the difference between dates within different products in tbl_future ?
For example, consider the below data rows in tbl_future:
1000 Product1 2011-01-01 12:00:00.000
1001 Product2 2011-01-01 12:00:00.000
1002 Product3 2011-01-01 13:00:00.000
1003 Product4 2011-01-01 13:00:00.000

I am asking this because the below solution will have to be scheduled on the correct analysis of the above data

Say for example, the batch of products have datetime differences by 0.5 hours

Then schedule a job which runs every 0.5 hours or every 5 minutes depending on the volume of the data with the following sql statement

insert into tbl_live
    select id, product from tbl_future where upTime = getdate()
-- here upTime is the datetime column in tbl_future
Share this answer
PKriyshnA 19-Jan-12 1:12am    
difference datetime between two product may be of 3-5 hour

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900