如何将数据从一个表转移到另一个表?

编程入门 行业动态 更新时间:2024-10-10 08:18:16
本文介绍了如何将数据从一个表转移到另一个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有两个表 Tbl_Future第一名 与 id,Product,Datetime Tbl_Live排名第二 与 id,产品 Tbl_Future中有一些带有时间的产品记录 现在我想在服务器时间达到产品时间时传输该数据, 然后在那个时候我想从Tbl_Future转移到Tbl_Live ..... ---- jab jis产品ka时间服务器时间jitna ho选项卡数据Tbl_Future mese Tbl_Live me transfer ho ..... 请帮助我.....

i have two tables 1st for Tbl_Future with id, Product , Datetime 2nd for Tbl_Live with 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.....

推荐答案

而不是两个表,为什么不保留一个表并使用类似的查询 SELECT * FROM tblData WHERE DateTime < getdate().除非您有一个非常具体的理由为什么要在系统中拥有冗余数据,否则我将采用这种方式. 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.

理想情况下,我会采用上述解决方案,但在某些情况下,您会这样做想要一个冗余的数据集.在这种情况下, tbl_future中不同产品中的日期之间有什么区别? 例如,考虑tbl_future中的以下数据行: 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

我之所以这样问,是因为必须根据上述数据的正确分析来安排以下解决方案 举例来说,这批产品的日期时间差为0.5小时 然后使用以下sql语句安排一个作业,该作业每0.5小时或每5分钟运行一次,具体取决于数据量

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

更多推荐

如何将数据从一个表转移到另一个表?

本文发布于:2023-07-09 10:05:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1085501.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   数据   转移到

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!