473,508 Members | 2,509 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rowlock in insert query

Hello All,
I am new to DB2,
Currently i am using DB2 version 8.02 personal edition on Windows XP
Professional.
And Facing problem with rowlock in insert query.

I have created a sample database as

CREATE TABLE SCEMANAME.LOG (
Sequence DECIMAL(9 ,0) NOT NULL ,
SubSequence DECIMAL(9 ,0) NOT NULL ,
RecordType DECIMAL(9 ,0) ,
LogDate TIMESTAMP ,
Name char (30) ,
Action char (80) ,
usertype DECIMAL(1) ,
sourceapp DECIMAL(1)
)

And now trying to fire queries on DB2

INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,SOURCEAPP)
VALUES(1,12,123,'2007-04-03 15:51:47.333','SANS','test',0,0);
but the query results in an error as ,

DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0104N An unexpected token "WITH" was found following "RT INTO
SCEMANAME.LOG". Expected tokens may include: "<space>".
SQLSTATE=42601

SQL0104N An unexpected token "WITH" was found following "RT INTO
SHELKESA.LOG". Expected tokens may include:
"<space ".
can anyone help me to solve this issue.

Apr 5 '07 #1
8 9383
Santy wrote:
Hello All,
I am new to DB2,
Currently i am using DB2 version 8.02 personal edition on Windows XP
Professional.
And Facing problem with rowlock in insert query.

I have created a sample database as

CREATE TABLE SCEMANAME.LOG (
Sequence DECIMAL(9 ,0) NOT NULL ,
SubSequence DECIMAL(9 ,0) NOT NULL ,
RecordType DECIMAL(9 ,0) ,
LogDate TIMESTAMP ,
Name char (30) ,
Action char (80) ,
usertype DECIMAL(1) ,
sourceapp DECIMAL(1)
)

And now trying to fire queries on DB2

INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,SOURCEAPP)
VALUES(1,12,123,'2007-04-03 15:51:47.333','SANS','test',0,0);
That's invalid syntax. There is no "WITH(...)" clause available where you
want to use it.

http://publib.boulder.ibm.com/infoce...c/r0000970.htm

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 5 '07 #2
Can you please suggest me required changes so that the query will runs
fine

INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,SOURCEAPP)
VALUES(1,12,123,'2007-04-03 15:51:47.333','SANS','test',0,0);

Thanks,
Santosh Shelke

Apr 5 '07 #3
Santy wrote:
Can you please suggest me required changes so that the query will runs
fine

INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,SOURCEAPP)
VALUES(1,12,123,'2007-04-03 15:51:47.333','SANS','test',0,0);
Follow the syntax diagram.

Hint: Simply remove the "WITH (ROWLOCK)"

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 5 '07 #4
On Apr 5, 3:31 pm, Knut Stolze <sto...@de.ibm.comwrote:
Santy wrote:
Can you please suggest me required changes so that the query will runs
fine
INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,SOURCEAPP)
VALUES(1,12,123,'2007-04-03 15:51:47.333','SANS','test',0,0);

Follow the syntax diagram.

Hint: Simply remove the "WITH (ROWLOCK)"

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany

Thanks For the reply...
But We have to add a locking while inserting data in the table ,
in that case which are the options available.
Apr 5 '07 #5
Santy wrote:
[...]
Thanks For the reply...
But We have to add a locking while inserting data in the table ,
in that case which are the options available.

What do you want to lock while writing? The row you are inserting?

Apr 5 '07 #6
On Apr 5, 4:20 pm, Lennart <erik.lennart.jons...@gmail.comwrote:
Santy wrote:

[...]
Thanks For the reply...
But We have to add a locking while inserting data in the table ,
in that case which are the options available.

What do you want to lock while writing? The row you are inserting?

yes by ROWLOCK we mean the same.

Apr 5 '07 #7
"Santy" <sh*********@gmail.comwrote in message
news:11**********************@y80g2000hsf.googlegr oups.com...
yes by ROWLOCK we mean the same.
DB2 will automatically lock (exclusive) the row you have inserted until you
do a commit. You should remove any explicit locking commands..
Apr 5 '07 #8
Santy wrote:
On Apr 5, 3:31 pm, Knut Stolze <sto...@de.ibm.comwrote:
>Santy wrote:
Can you please suggest me required changes so that the query will runs
fine
INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,SOURCEAPP)
VALUES(1,12,123,'2007-04-03 15:51:47.333','SANS','test',0,0);

Follow the syntax diagram.

Hint: Simply remove the "WITH (ROWLOCK)"

Thanks For the reply...
But We have to add a locking while inserting data in the table ,
in that case which are the options available.
DB2 automatically locks newly inserted rows and does not force the
application to worry about such details.

If you want to have another locking granularity, you could use the LOCK
TABLE statement to lock the whole table.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 10 '07 #9

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

Similar topics

2
1900
by: avinash | last post by:
hello myself avinash i am developing on application having vb 6 as front end and sql server 7 as back end. when i use insert query to insert data in table then the date value of that query is...
8
6274
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with...
5
15392
by: Annie | last post by:
hello guys, I have little experience working with C# and MS Access ... I am having an insert query with one datetime field and a boolean and couple of text and number fields as below: ...
0
1276
by: clickon | last post by:
I want to use an INSERT Query as the value for the UpdateCommand property of an SQL datasource, anyone know if this will actually work ? The reason i want to do it is bacause i am taking values...
1
6190
by: abhi81 | last post by:
Hello All, I have a table on which I have created a insert,Update and a Delete trigger. All these triggers write a entry to another audit table with the unique key for each table and the timestamp....
0
463
by: Santy | last post by:
Hello All, I am new to DB2, Currently i am using DB2 version 8.02 personal edition on Windows XP Professional. And Facing problem with rowlock in insert query. I have created a sample database...
1
2750
by: Luqman | last post by:
I have created a Insert Query in Sql Data Source using Oracle Database, with the parameters, and its connected with DetailView Control. When I try to Insert through DetailView Control, Illegal...
0
2274
by: magnolia | last post by:
i created a trigger that will record the changes made to a table .everything works fine except the insert query.whenerever i try to insert a record it fires insert and update triger at the same time...
1
2052
by: Marco van der M | last post by:
Hello everyone, I am trying to make an insert query that inserts information using form values and a query that gets the id from the name of a field in the form. I got a form that shows object...
0
7231
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,...
0
7133
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...
0
7336
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,...
1
7066
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...
0
7504
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...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
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 ...
0
435
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...

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.