By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,334 Members | 1,266 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,334 IT Pros & Developers. It's quick & easy.

inserted values required with the given format

P: 1
Here is a table structure :

Column Type Type
name schema name Length Scale Nulls

EMPNO SYSIBM INTEGER 4 0 Yes

ENAME SYSIBM CHARACTER 20 0 Yes

CNTY_VISITED SYSIBM CHARACTER 100 0 Yes

Now goes the prob.....

I want to insert a row in the table such that the data in the table shud look as :

EMPNO ENAME CNTY_VISITED
1001 JACK 'IND','JPN'

I guess you understood the req. It should not be IND,JPN.. It should be ' IND ' , ' JPN '
in the table.
Aug 1 '07 #1
Share this Question
Share on Google+
2 Replies


10K+
P: 13,264
Here is a table structure :

Column Type Type
name schema name Length Scale Nulls

EMPNO SYSIBM INTEGER 4 0 Yes

ENAME SYSIBM CHARACTER 20 0 Yes

CNTY_VISITED SYSIBM CHARACTER 100 0 Yes

Now goes the prob.....

I want to insert a row in the table such that the data in the table shud look as :

EMPNO ENAME CNTY_VISITED
1001 JACK 'IND','JPN'

I guess you understood the req. It should not be IND,JPN.. It should be ' IND ' , ' JPN '
in the table.
The basic structure of an insert statement is
Expand|Select|Wrap|Line Numbers
  1. insert into schema.tableName(col1, col2) values (val1, val2)
Edit: and if you want to concatenate two strings s1 and s2, you can use the concat function as explained here.
Aug 1 '07 #2

P: 57
create table EMP_VISITS(EMPNO INT,
ENAME CHAR(20),
CNTY_VISITED CHAR(100));

insert into EMP_VISITS
values (1001, 'JACK', '''IND'',''JPN''');

Not that each single quote within the string needs to be doubled. i.e.two single quote characters.
Aug 1 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.