Вы находитесь на странице: 1из 3

pdfcrowd.com open in browser PRO version Are you a developer?

Try out the HTML to PDF API


Database Skill
Database Skill
About MySql, SQL Server, Oracle, PostgreSql, DB2,
SyBase, SQL, T-SQL, PL-SQL.
Database Mysql Sql Sqlserver
Rational use of DW multi-table updates the PB
Tag: work, sql, String, table, database Category: Sql Author: CHENRUBIN Date: 2011-09-14
Case: have a business need to update two or more tables analysis:
Update two tables simply is one of the tables DW update SQL update another table; or page trigger other table updates. But this similar
business is undoubtedly greatly increase the workload. And maintenance inconvenient.
But we carefully consider, DW naturally had his weapon as PB. Update the property seems to be designed for this multi-table updates.
The PB update the database when first look at the updated table, and then see the need to update the column. In other words, only
when the update set update properties, can facilitate the realization of multi-table updates.
The step can be simply understood as: the profile update table as Table 1, Table 1, column as updatable column. After updating and
then set the table as update the table, the column in Table 2 as can be updated column.
Example:
Suppose a tabletbl_1 (col_1 is col_2), tbl_2 (col_1 is, col3)
, DW SQL
select tbl_1.col_1 to
tbl_1.col_2
tbl_2.col_3
from tbl_1, tbl_2
where tbl_1.col_1 = tbl_2.col_1
DW made a series of operations, execute the following script on update
long ll_cnt = 0
int i = 0
string ls_table [2] = {'tbl_1', 'tbl_2'}
Related
[PB] multi-table updates
[PB] DW DBError event
PB DW applications
PB DW applications
PB the DW data window operation will learn
PB the DW data window operation will learn
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
string ls_col the
string ls_col_dbname the
string ls_update the
string ls_updateable the
string ls_error the
boolean lb_update is
/ / Loop table a list of multi-table updates
for i = 1 to upperBound (ls_table)
/ / Loop dw column
for ll_cnt = 1 to long (dw_1.describe ("DataWindow.Column.Count"))
ls_col = dw_1.describe ("#" + string (ll_cnt) + ". name")
ls_col_dbname = dw_1.describe ("#" + string (ll_cnt) + ". dbname")
/ / Update the table column or key, set to update column
/ / Here can be public column as updatable column
if pos (ls_col_dbname, ls_table + ".") = 1 or &
lower (dw_1.describe ("#" + string (ll_cnt) + ". key")) = "yes" then
ls_updateable = ". update = yes"
else
ls_updateable = ". update = no"
end if
ls_update + = "~ t" + ls_col + ls_updateable
next
/ / Set the update table
ls_update + = "~ tDataWindow.Table.UpdateTable = '" + ls_table [i] + "'"
/ / Update the correct settings, update
ls_error = dw_1.modify (ls_update)
if trim (ls_error) <>'' or ls_error <> '!' then
if dw_1.update (true, false) = 1 then
lb_update = true
else
lb_update = false
/ / Exit for loop
exit
end if
end if
nex
/ / Here to commit the transaction updates
if lb_update then
commit;
/ / Reset dw
dw_1.resetupdate ()
else
rollback;
end if
/ / Here is complete multi-table updates
PB the DW data window operation will learn
[VB.NET] multi-table updates
Oracle multi-table updates
How the rational teamtest of software testing tools in
PB
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
2009-2014 databaseskill.com Contact Us | Privacy Policy | Disclaimer | Disclosure