467,168 Members | 1,029 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,168 developers. It's quick & easy.

inserted values required with the given format

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
  • viewed: 1210
Share:
2 Replies
8TB
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
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.

Similar topics

3 posts views Thread by Miran Kopmajer | last post: by
reply views Thread by pathisunil@gmail.com | last post: by
3 posts views Thread by Steve Weixel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.