Thursday, October 7, 2010

How to insert a string having quotes into a column?

Problem:
Say there are some values coming for given column say comments  like
'It's a wonderful day'
'I don't know '

As we know that teradata  considers anything between two quotes to be 1 statement . But what if we need to insert the statement having the quotes as apostrophe in it?(above examples)

CREATE SET TABLE SAMPLE1
(
col1 VARCHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC)
PRIMARY INDEX ( col1 );

To insert these values , I need to use insert statements as below.
insert into SAMPLE1 values('It"s a wonderful day');
insert into SAMPLE1 values('I don"t know ');

In case of teradata, two consequent apostrophe    are used instead of one’

No comments:

Post a Comment