473,796 Members | 2,669 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding a generated column

I have two related questions. Why did I have to:

SET INTEGRITY FOR is3.animals OFF;

before doing:

alter table is3.animals
add column pseudo_id
generated always as
(coalesce(regnu m, cast(bhid as char(10))));

It may be of importance that bhid is the primary key of animals.

Why are other <table>s which are dependent on animals, as a foreign key,
also require:

SET INTEGRITY FOR is3.animals IMMEDIATE CHECKED FORCE GENERATED;
SET INTEGRITY FOR is3.<table> IMMEDIATE CHECKED FORCE GENERATED;

Nov 12 '05 #1
1 4558
Robert Stearns wrote:
I have two related questions. Why did I have to:

SET INTEGRITY FOR is3.animals OFF;

before doing:

alter table is3.animals
add column pseudo_id
generated always as
(coalesce(regnu m, cast(bhid as char(10))));

It may be of importance that bhid is the primary key of animals If integrity for the table would not be turned off DB2 would need to do
the FORCE GENERATED processing right away in the ALTER TABLE statement.
If your table is of non trivial size this can mean a lot of logging.
Now - when expression-generated columns were added to DB2 log space was
fairly limited and we (DB2 Dev) felt that there is significant risk of
folks running out of log-space.
So we gave customers two options:
Use SET INTEGRITY to generate the values, or
use a little tool call db2gncol which generates the values using a
commit count. (and then use SET INTEGRITY to re-enable the table without
having to do FORCE GENERATED.
Now that was the past. Using SET INTEGRITY is still usefull however in
case you also want to do other changes to the table. You can batch them
up uf do all the work in one shot.
One could argue DB2 should now allow ALTER TABLE to do the whole work,
but so far it simply hasn't been more than a "yeah.. someday we'll fix
that".

Why are other <table>s which are dependent on animals, as a foreign key,
also require:

SET INTEGRITY FOR is3.animals IMMEDIATE CHECKED FORCE GENERATED;
SET INTEGRITY FOR is3.<table> IMMEDIATE CHECKED FORCE GENERATED;

If you didn't do more than add the geneated column to animals you can
take the <table> out of check pending
UNCHECKED. For sure you do NOT need FORCE GENERATED on <table>.

Cheers
Serge

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1925
by: Chris Millar | last post by:
I have a user control that i wish to extend to change the date when the user selects the numeric up down button. The code explains itself, hope someone can help. any ideas appreaciated.. Chris. code :
0
12292
by: Andrew | last post by:
If item is a ListViewItem and str is a string, why do the following two lines not have the same effect ? item.SubItems.Add(new ListViewItem.ListViewSubItem()).Text = str; item.SubItems.Add(str); In the example code that follows, using the first line (in the ListView constructor) causes the later redisplay of values (to some specified number of decimal places) in the ListView not to work. Using the second line causes
0
1825
by: Sam Vanderstraeten | last post by:
Hi All, - Visual Studio 2002 - VB.NET > ASP.NET I created a DataGrid on a webform. This datagrid has sorting enabled. I want to create in the header of each column (that is a sorting-hyperlink) a textbox. When my user clicks on a sort-hyperlink, I want to sort that column, but I also want to combine that with a rowfilter. That rowfilter should be the filtervalue, entered in the textbox of that specific column.
16
2490
by: Geoff Jones | last post by:
Hi Can anybody help me with the following, hopefully simple, question? I have a table which I've connected to a dataset. I wish to add a new column to the beginning of the table and to fill it with incremental values e.g. if the tables looks like this: 23 56
1
4833
by: Ben Ramsey | last post by:
I'm using PostgreSQL on a Windows 2000 server and cygwin. All is set up just fine. The database works just fine, and ASP is connecting to the database through a DSN just fine. The only problem I seem to have is adding a large amount of text to a text column in the database. I can enter up to 8,118 characters (including spaces), but when I go over that amount, I receive the following error: Microsoft OLE DB Provider for ODBC Drivers...
5
51682
by: GG | last post by:
I am trying to add a nullable datetime column to a datatable fails. I am getting exception DataSet does not support System.Nullable<>. None of these works dtSearchFromData.Columns.Add( new DataColumn( "StartDate", typeof( DateTime? ) ) ); dtSearchFromData.Columns.Add( new DataColumn( "EndDate", typeof( System.Nullable<DateTime>) ) ); Any ideas?
7
1788
by: Miro | last post by:
Im a VB Newbie so I hope I'm going about this in the right direction. I have a simple DB that has 1 Table called DBVersion and in that table the column is CurVersion ( String ) Im trying to connect to the db, and then add a record to the DBVersion table. Except I cant. I have 1 line that crashes and if i rem it out it works but nothing gets added.
3
1187
by: triumph | last post by:
Hi, I'm using datagrid where i have some fields generated from sql. I have to include some other fields which have been set as default columns given below. Dim dttad As New DataTable Dim dr As DataRow dttad.Columns.Add(New DataColumn("S.No", GetType(String))) .. ....dgtad.DataSource = dttad
15
1722
by: kigoobe | last post by:
Well friends, I am having a table like this ... http://kigoobe.com/offshoring/bugs/javascript/javascriptAddData.gif Where, the left most and right most columns have zero values when the page loads. As we click on the + or - sign associated with the left most column, the value of the left most column increases or decreases by 1. The value of the right most column also changes at the same time, and gives the value of the left most column *...
0
9684
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10017
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5445
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.