Re: SQL statement contain " character



Note that in Delphi you should double number of quotes - you double quote
once for MS SQL Server, another time - for Delphi:

sql := 'update TableName set TextField = ''Could not save with '''' in
text''';

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Dave Albiston" <mail@xxxxxxxxxxxxxxxxxx> ???????/???????? ? ????????
?????????: news:43db5cfc$1@xxxxxxxxxxxxxxxxxxxxxxxxx
> My application stores text which often contains the " character for
> inches. I am dynamically constructing a statement like:
>
> update Tablename
> set TextField = 'Could not save with " in text',
> .
> .
> where TableID = ..
>
> The statement is accepted by SQL Server 2000 using Query Analyzer but
> fails when I execute it with a TADOQuery in D2005. The error message is:
>
> 'Parameter object is improperly defined. Inconsistent or incomplete
> information was provided.'
>
> If I remove the " character it works. It also works with the character if
> I set ParamCheck to false.
>
> Is there an explanation or is this a bug?
>
> Dave


.



Relevant Pages

  • Re: Conversion error
    ... text (character strings) before importing them into SQL ... I have defined all columns in the SQL Server ... all values properly to varchar. ... money data. ...
    (microsoft.public.sqlserver.dts)
  • Re: The best elegant solution to override 65k rows limit in a sheet
    ... >I'm sorry that your jerry-rigged spreadsheet program isn't flexible ... Single quotes are used to delimit different syntactic tokens than ... >I'm so sorry that you work for a stupid company; SQL Server is WINNING ... it doesn't take as many IBM mainframes running DB/2 to do the same work ...
    (microsoft.public.excel)
  • RE: strange problem with sql
    ... The difference in the character _ and W is just one bit. ... There are other letters that are getting mistranslated: ... My onlly guess now is that there is a memory ... > that at one occassion the SQL Server executed was changed on one ...
    (microsoft.public.data.ado)
  • Re: BULK COPY changes row order importing Text file
    ... Error = [ODBC SQL Server Driver]Invalid character value for cast ... BCP copy in failed ...
    (microsoft.public.sqlserver.programming)
  • RE: strange problem with sql
    ... The difference in the character _ and W is just one bit. ... There are other letters that are getting mistranslated: ... My onlly guess now is that there is a memory ... > that at one occassion the SQL Server executed was changed on one ...
    (microsoft.public.sqlserver.programming)