As a converted sybase dba, I have a question. In sybase a command can
be executed multiple times by placing a
go 1000
at the end of the statement. Such as:
insert into a (col1, col2)
values (1,2)
go 1000
this will put the values 1 and 2 in the respective columns for 1000
rows.
Is there an equivalent in db2 udb, v8.2.2?
Thank you,
Kermit Lowry 3 7983
Ultrak The DBA wrote:
As a converted sybase dba, I have a question. In sybase a command can
be executed multiple times by placing a
go 1000
at the end of the statement. Such as:
insert into a (col1, col2)
values (1,2)
go 1000
this will put the values 1 and 2 in the respective columns for 1000
rows.
Is there an equivalent in db2 udb, v8.2.2?
Not through the driver, but you can write this many different ways:
--#SET TERMINATOR @
BEGIN ATOMIC
DECLARE i INT DEFAULT 0;
WHILE i < 100 DO
INSERT INTO T VALUES (1, 2);
END WHILE;
END
@
--#SET TERMINATOR ;
Or you can use recursion:
INSERT INTO T WITH rec(c1, c2, i) AS
(VALUES (1, 2, 0)
UNION ALL
SELECT c1, c2, i + 1 FROM rec WHERE i < 100)
SELECT c1, c2 FROM rec;
Or use the fact that DB2 supports multi row insert:
INSERT INTO T VALUES
(1, 2), .... (1, 2);
or use your shell
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Serge Rielau wrote:
Or you can use recursion:
INSERT INTO T WITH rec(c1, c2, i) AS
(VALUES (1, 2, 0)
UNION ALL
SELECT c1, c2, i + 1 FROM rec WHERE i < 100)
SELECT c1, c2 FROM rec;
Interesting. If you needed to use a CTE (with or without recursion)
for a DELETE or UPDATE statement, what would that look like? Or is it
even possible?
INSERT INTO T
SELECT 1, 2
FROM (VALUES 0,1,2,3,4,5,6,7 ,8,9) p1(n)
,(VALUES 0,1,2,3,4,5,6,7 ,8,9) p2(n)
,(VALUES 0,1,2,3,4,5,6,7 ,8,9) p3(n) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: RotterdamStudents |
last post by:
Hello there,
i have a strange problem. I can't get php to insert multiple rows at once in
a MySQL database. I use the
$sql = "INSERT INTO database (a,b,c,d,e) VALUES ('$a', '$b' ,'$c', '$d',
'$e')";
I want to insert 5 rows at a time in the database, but it only inserts every
5th record. For example:
1. AA
|
by: Sans Spam |
last post by:
Greetings! I have a table that contains all of the function
permissions within a given application. These functions are different
sections of a site and each has its own permissions (READ, WRITE,
UPDATE, DELETE) which are controlled by a web frontend and the table
records are manipulated to control the permissions.
Example:
The Press Release section record would look like this:
Username: John Doe
Function Name: Press Release
|
by: pb648174 |
last post by:
I have a single update statement that updates the same column multiple
times in the same update statement. Basically i have a column that
looks like .1.2.3.4. which are id references that need to be updated
when a group of items is copied. I can successfully do this with
cursors, but am experimenting with a way to do it with a single update
statement.
I have verified that each row being returned to the Update statement
(in an...
|
by: wxbuff |
last post by:
I have a report based on our product names that consists of two parts.
Both insert data into a temporary table.
1. A single grouped set of results based on all products
2. Multiple tables based on individual product names.
I am getting data by calling the same stored procedure multiple
times... for the single set of data I use "product like '%'"
To get the data for individual products, I am using a cursor to parse
|
by: SSP |
last post by:
Dear ASP.NETers,
How would I insert multiple rows of data from a web form?
Are there any tute's and stuff around. Couldn't find any myself.
Thanks in advance.
SSP
| |
by: Nathan Sokalski |
last post by:
I have user controls that contain a link to a stylesheet. Several of my
pages also have a link to this same stylesheet. Because of this, the
resulting output contains multiple links to the same stylesheet. Although
this does not cause any harm as far as how the page looks, it is unnecessary
and makes the download take slightly longer. Is there any easy way to avoid
having the same stylesheet link added multiple times? Thanks.
--
Nathan...
|
by: billa856 |
last post by:
Hi,
My project is in MS Access 2002.
In that I want to open one form multiple times.
I put one button on my main form.
Now whenever I click on that button than form will be open.
Now when I click again on that same button than it will open same form again in seperate window.
But instead of that already open form comes.and so i couldn't open that form multiple times.
Already open form must be remain as it is even if I click on that button...
|
by: bonneylake |
last post by:
Hey Everyone,
Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also the parts section an i seem to be having trouble.
When i try to insert into the parts section i get the error Invalid character value for cast specification. But not sure what i am doing wrong. Here is what i am using to insert. All the sections...
|
by: omaragainonthetrack |
last post by:
public void InsertPlannedMaterialMasterRequest(int id, string requestDocument, string requestDescription, string requestType, string hodApproval, int companyCode, string hodRemarks, string det_Description, string name, int qty, string code)
{
string query = "INSERT INTO MasterRequest (ID,Req_Document,Req_Description,ReqType,HODApproval,CompanyCode,HODRemarks) VALUES...
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |