将一个表的所有数据插入到另一个表的一列中 [英] insert all data of one table to the one column of other table

查看:349
本文介绍了将一个表的所有数据插入到另一个表的一列中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表一个队列和其他突出...现在,当我点击按钮时,包括列名在内的所有数据都应插入队列的消息列中...请给它一些想法或代码

i have two tables one queue and other outstand ... now when i click button all data of outstand including there column name should be inserted into message column of queue ... please give some idea or code for it

推荐答案

这是一个沙哑的算法。您可以进一步优化它:



1.用户点击按钮。

2.触发查询,该查询将创建一个列名称和来自优秀表的值(如XML)并将其插入到Queue中。所以,如果你有类似的东西:Column1包含''A'',Column2包含''B'',Column3包含''C'' - 使用查询:



Here''s a scratchy algorithm for it. You can refine it further:

1. User clicks button.
2. Fire a query which will create a string of column name and their values (like an XML) from the outstanding table and insert it into Queue. So, if you have something like: Column1 contains ''A'', Column2 contains ''B'' and Column3 contains ''C'' - use the query:

Insert into Queue (Message)
Select '<column1>' || Column1 || '</column1>' ||
       '<column2>' || Column2 || '</column2>' ||
       '<column3>' || Column3 || '</column3>'
From Outstanding;





结果字符串为:



The resultant string will be:

<column1>A</column1>
<column2>B</column2>
<column3>C</column3>





您可以创建其他形式的字符串以及管道分隔而不是XML。我猜想XML会更合适。它将帮助您以后轻松解析字符串,以防您需要检索它。



You can create the string in some other form as well like pipe delimited instead of XML. XML will be better suited I guess. It will help you parse the string easily later in case you have to retrieve it.


这篇关于将一个表的所有数据插入到另一个表的一列中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆