Solved

SQL Script - Insert comma separated values with a comma in value

Posted on 2007-11-30
3
3,689 Views
Last Modified: 2008-02-01
In the 5th value I am entering below, I actually want to enter the comma in the middle.  I want to enter this as the 5th value '''1900-01-01''','''0001-01-01'''.  Is there some kind of escape character I can use to enter that in the manner described?

insert into CMvCM2.dbo.LA_Analysis_Var_MICLGCDt values (
'score1',
29,'-29',
536870912,
'd.MICLGCDt',
'''1900-01-01''','''0001-01-01''',
'b.MICLGDt',
'''01-01-1900''')
0
Comment
Question by:donnatronious
3 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 20386178
You do not need to escape commas.
0
 
LVL 25

Accepted Solution

by:
imitchie earned 500 total points
ID: 20386635
insert into CMvCM2.dbo.LA_Analysis_Var_MICLGCDt values (
'score1',
29,'-29',
536870912,
'd.MICLGCDt',
'''1900-01-01'',''0001-01-01''',
'b.MICLGDt',
'''01-01-1900''')

I've removed two extraneous single quotes for you.  below is what it looks like (added spaces for clarity)
begin quote -- escaped quote --- escaped quote --- comma --- escaped quote ---- escaped quote ----- end quote
'   ''    1900-01-01''    ,     ''    0001-01-01    ''    '
0
 
LVL 5

Expert Comment

by:ursangel
ID: 20394405
Why dont you directly use the whole things inside a single quoted string
i didn get your reason for using it in this way.
'1900-01-01,0001-01-01'

if im wrong, please correct me
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question