Solved

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

Posted on 2007-11-30
3
3,682 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now