VB6, MSSQL, INSERT INTO, string with carriage returns

Hi,

I am reading from an entry field that has carriage returns and/or line feeds in it.  When I look

When move the text field into a varibale and look at the contents in my watch window I can see that the text is on separate lines.

Can I just insert this text as is into an MSSQL nvarchar field or is there a special select statment to ensure the carriage returns are preserved ?

Thank-you.
LVL 1
jcwiatrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaauCommented:
If you use prepared statement you will be able to insert the string as it is. Just Goggle VB6 prepared statement, you will find plenty examples in the Internet
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
John GobertEnterprise Systems ConsultantCommented:
If you want to keep the CRLF characters then there's nothing special you need to do when storing the string in a variable.  You'd only need to do something different if you wanted to remove the characters which it doesn't sound like you are.

If you ran a select statement in SQL Management Studio you wouldn't see the CRLF since the value returns in a grid form... however, if you copied the contents and put them in a text editor the characters would be handled properly.  You may not see them but they're there unless you specifically remove them.
0
jcwiatrAuthor Commented:
Accepting both responses. jpgobert thank-you for identigying that I would not see them in Management Studio - this is where I was tripping up.

Also found out during investigations that if from toolbar-Query-Text you can see the output as it has been written with the correct spacing etc.

Thank-you both for responding.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.