Specifying carriage return/line feed in an SQL statement
Specifying carriage return/line feed in an SQL statement
(OP)
Hi there, I hope you can help us.
We're using this statement to import some values into a database:
SQLStatement = "INSERT MyTable (ID, VALUE) VALUES ('" & IDString & "', '" & VALUEString & "')"
The problem is that the strings might contain carriage returns/line feeds, i.e.
VALUEString = "Line 1." & vbCrLf & "Line 2."
It only imports up until the first vbCrLf. We have tried replacing vbCrLf with "\n", but this doesn't work either. What is the correct format for inserting a value that contains new line characters?
Thanks for your time,
Lasse.
We're using this statement to import some values into a database:
SQLStatement = "INSERT MyTable (ID, VALUE) VALUES ('" & IDString & "', '" & VALUEString & "')"
The problem is that the strings might contain carriage returns/line feeds, i.e.
VALUEString = "Line 1." & vbCrLf & "Line 2."
It only imports up until the first vbCrLf. We have tried replacing vbCrLf with "\n", but this doesn't work either. What is the correct format for inserting a value that contains new line characters?
Thanks for your time,
Lasse.





RE: Specifying carriage return/line feed in an SQL statement
I have worked in simial problem. Change your column type to VarChar and instead of single quote (') in insert into statement use double quotes. I have attached a example for your convience.
INSERT INTO mytab (ID, VAL) VALUES (" & CHR(34) & idstr & CHR(34) & "," & CHR(34) & valstr & CHR(34) & ")"
For further details please let me know things like a complete description like database environment, column types etc.
RE: Specifying carriage return/line feed in an SQL statement
i would like to insert a carriage return into my select statement - but I couldn't find the sign for the carriage return anywhere!
I hope there is help out there,
Ramona
RE: Specifying carriage return/line feed in an SQL statement
i would like to insert a carriage return into my select statement - but I couldn't find the sign for the carriage return anywhere!
I hope there is help out there,
Ramona