Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Problem with " character

Author  Topic 

DaveA
Starting Member

6 Posts

Posted - 2006-01-27 : 10:16:56
I am having problems inserting text which has the " character. In some cases, I have achieved success by rearranging the SQL statement but was not convinced that was a complete solution.

I now have a statement which fails when " appears in the text and changing the order of columns in the update statement has failed.

Any ideas?

Dave

SQL Server 2000 + Delphi 2005 + ADO controls.

Norwich
Posting Yak Master

158 Posts

Posted - 2006-01-27 : 10:51:31
Please post your code and the error

N

The revolution won't be televised!
Go to Top of Page

Billkamm
Posting Yak Master

124 Posts

Posted - 2006-01-27 : 16:28:41
Some FAQs on quote usage:

http://www.aspmessageboard.com/forum/showMessage.asp?M=75557&P=1&F=21
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=27
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-01-27 : 16:30:16
This is one of the many reasons why you should use parameters and not build SQL strings dynamically and execute them.
Go to Top of Page

DaveA
Starting Member

6 Posts

Posted - 2006-01-28 : 06:08:10
On further investigation, the SQL statement I am constructing dynamically is accepted by SQL Server if submitted using Query Analyzer. This suggests that the problem lies in the Delphi ADO components.

Many thanks for the replies.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-01-28 : 07:00:12
If you do not have this cracked in your application's function library I would suggest that you are probably not immune to injection attacks, so you might want to take that into account whilst you are working on a solution to this specific problem.

We pass all dynamic sql strings through a quote-doubler function, which also does some other duties. However, we more commonly use parameterized Sproc calls in the way that jsmith8858 said

Kristen
Go to Top of Page
   

- Advertisement -