Hello,
I have a small dilemma I need some help with. I would like to insert into a DB2 table the system date (timestamp) along with data retrieved via a db2 select statement but I am unsure how to code it using one statement.
I would like to use the following format to insert to the table but I am unsure how to add the "VALUES (CURRENT TIMESTAMP)"
Format I would like to use..... - db2 "INSERT INTO table1 (id, type, records, country) select id, type, count(*), country from tdb.table2 where id = 222 and group by id, type"
Also here is the table stucture, -
Column Type Type
-
name schema name Length Scale Nulls
-
------------------------------ --------- ------------------ -------- ----- ------
-
SYSTEM_DATE SYSIBM TIMESTAMP 10 0 No
-
ID SYSIBM DECIMAL 6 0 Yes
-
TYPE SYSIBM VARCHAR 25 0 Yes
-
RECORDS SYSIBM DECIMAL 8 0 Yes
-
COUNTRY SYSIBM VARCHAR 2 0 Yes
Thanks in advance
1 1775
Hello,
I have a small dilemma I need some help with. I would like to insert into a DB2 table the system date (timestamp) along with data retrieved via a db2 select statement but I am unsure how to code it using one statement.
I would like to use the following format to insert to the table but I am unsure how to add the "VALUES (CURRENT TIMESTAMP)"
Format I would like to use..... - db2 "INSERT INTO table1 (id, type, records, country) select id, type, count(*), country from tdb.table2 where id = 222 and group by id, type"
Also here is the table stucture, -
Column Type Type
-
name schema name Length Scale Nulls
-
------------------------------ --------- ------------------ -------- ----- ------
-
SYSTEM_DATE SYSIBM TIMESTAMP 10 0 No
-
ID SYSIBM DECIMAL 6 0 Yes
-
TYPE SYSIBM VARCHAR 25 0 Yes
-
RECORDS SYSIBM DECIMAL 8 0 Yes
-
COUNTRY SYSIBM VARCHAR 2 0 Yes
Thanks in advance
You can try this command: -
-
INSERT INTO table1 (SYSTEM_DATE, id, type, records, country)
-
select CURRENT TIMESTAMP, id, type, count(*), country from
-
tdb.table2 where id = 222
-
and group by id, type
-
-
Regards
-- Sanjay
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Joel Thornton |
last post by:
Whenever something is inserted to a given table, I want to run some
shell commands using xp_cmdshell. Would it be a bad idea to put this
xp_cmdshell in the INSERT trigger of this table?
I...
|
by: shottarum |
last post by:
I currently have 2 tables as follows:
CREATE TABLE .
(
mhan8 int,
mhac02 varchar(5),
mhmot varchar(5),
mhupmj int
)
|
by: Jean-Christian Imbeault |
last post by:
I have a table with a primary field and a few other fields. What is the
fastest way to do an insert into that table assuming that sometimes I
might try to insert a record with a duplicate primary...
|
by: Philip Boonzaaier |
last post by:
I want to be able to generate SQL statements that will go through a list of
data, effectively row by row, enquire on the database if this exists in the
selected table- If it exists, then the colums...
|
by: robert |
last post by:
been ruminating on the question (mostly in a 390/v7 context) of
whether, and if so when, a row update becomes an insert/delete.
i assume that there is a threshold on the number of columns of
the...
|
by: Andrew |
last post by:
Hi, friends,
In ASP, we use
obj = CreateObject("com.dll")
obj.GetHTMLText(inVal, outHTMLTxt1, outHTMLTxt2)
to get different HTML strings based on input values.
Then, we insert them into...
|
by: Geoffrey KRETZ |
last post by:
Hello,
I'm wondering if the following behaviour is the correct one for
PostGreSQL (7.4 on UNIX).
I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching
the following request :...
|
by: David Eades |
last post by:
Hi all
Complete newbie here, so apologies if this is the wrong forum.
I've been asked to use mysql and asp to make a simple bidding system (rather
like a simple ebay), whereby users can use a...
|
by: solomon_13000 |
last post by:
connection.asp:
<%
Sub RunQueryString (pSQL,parms)
on error resume next
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &...
|
by: rn5a |
last post by:
During registration, users are supposed to enter the following
details: First Name, Last Name, EMail, UserName, Password, Confirm
Password, Address, City, State, Country, Zip & Phone Number. I am...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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,...
|
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...
| |