SQL script line breaks causing errors on execution

I am using SQL Server 2008 R2 and sql scripts to export data (11000+ rows) out of one db into another due to firewall and port closures but most of the INSERT commands are broken over multiple lines and to go through them all would take hours to correct.

INSERT [dbo].[Publications] ([PublicationID], [Title], [Author1], [Author2], [Author3], [Journal], [PubYear], [Volume], [Issue], [Pages], [Number], [Abstract], [LanguageID], [BUPP], [ISSN], [CortextID], [Content1], [Content2], [PDFFile], [FullTitle], [Suboxone], [KeySuboxone], [DateCreated], [CreatedBy], [DateModified], [ModifiedBy], [Live], [Deleted]) VALUES (2, N'Myocardial Infarction associated with methadone and/or dihydrocodeine.', N'Backmund M Meyer K, Zwehl W, Nagengast O & Eichenlaub D', NULL, NULL, N'European Addiction Research', 2001, N'7', N'1', N'37-9', NULL, N'Abstract
Chest pain and myocardial infarction occurring in young people with angiographically normal coronary arteries is well documented. Opiates have a cardioprotective effect and are used in acute heart attacks. We described a 22-year-old opioid addicted male patient who suffered a myocardial infarction following the consumption of methadone and dihydrocodeine.

', 29, NULL, N'0163-4356', NULL, NULL, NULL, NULL, N'Myocardial Infarction associated with methadone and/or dihydrocodeine.', NULL, NULL, NULL, NULL, NULL, NULL, 1, 0)

Open in new window


Is there an easier way for me to correct this mistake so that my sql script does not continuously error?
swgdesignAsked:
Who is Participating?
 
swgdesignAuthor Commented:
Neither of those was what I was after; I actually needed to replace the erroneous carriage returns in my db table with spaces. So, I did a find and replace on my column replacing char(10) and char(13) with spaces.
0
 
the_endjinnCommented:
What is the error you are getting on execution?
0
 
the_endjinnCommented:
Also, a backslash \ is the line continuation character for TSQL if that is what you are after.

INSERT [dbo].[Publications] ([Publication\
ID], [Title], [Author1], [Author2]

Open in new window

0
 
swgdesignAuthor Commented:
Found the solution myself and found out that replacing char(10) and char(13) with ' ' solved the data issue
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.