Invalid character 
Author Message
 Invalid character

Hi,

We are in the process of switching from Sybase ASA
to MSSQL Server Enterprise 8/SP1.
Development is with PowerBuilder 7.0.
Lately, we have been getting an intermittent error
message:
 'Invalid character value for cast specification'

In the code there is only one cast. The code is:

 (cast("dba"."examinee"."mescase" as varchar) +
cast("dba"."examinee"."case_sup" as  varchar)) AS
case_no

Mescase and case_sup are numeric.

The form from which  this code is taken is
accessed hundred's of times a day and the error
occurs 1 to 2 times a week. I have noticed that
when the error occurs, the form being processed
has a name with an apostrophe in it (ie. O'Brien).
The code for the name is:

 (ISNULL(rtrim("dba"."examinee"."first_name"),'')
+ master.dbo.IFNULL ("dba"."examinee"."mi",'',' '
+ "dba"."examinee"."mi" + '.') + master.dbo.IFNULL
("dba"."examinee"."last_name",'',' ' +
rtrim("dba"."examinee"."last_name"))) AS
examinee_fullname,

'master.dbo.IFNULL' is an in house function for
concatenating names. Would there be something in
the SQL code processing itself that would 'see'
the apostrophe and cause the error?

Any ideas appreciated.  Thanks in advance.

Duane Birrell



Sat, 29 May 2004 05:37:16 GMT
 Invalid character

The apostrophe is the string identifier in MS SQL. So this 'O'Brien' is
invalid. You have to double the apostrophe: 'O''Brien'. Have your function
return a double ' and see if that helps.

Zach


Quote:
> Hi,

> We are in the process of switching from Sybase ASA
> to MSSQL Server Enterprise 8/SP1.
> Development is with PowerBuilder 7.0.
> Lately, we have been getting an intermittent error
> message:
>  'Invalid character value for cast specification'

> In the code there is only one cast. The code is:

>  (cast("dba"."examinee"."mescase" as varchar) +
> cast("dba"."examinee"."case_sup" as  varchar)) AS
> case_no

> Mescase and case_sup are numeric.

> The form from which  this code is taken is
> accessed hundred's of times a day and the error
> occurs 1 to 2 times a week. I have noticed that
> when the error occurs, the form being processed
> has a name with an apostrophe in it (ie. O'Brien).
> The code for the name is:

>  (ISNULL(rtrim("dba"."examinee"."first_name"),'')
> + master.dbo.IFNULL ("dba"."examinee"."mi",'',' '
> + "dba"."examinee"."mi" + '.') + master.dbo.IFNULL
> ("dba"."examinee"."last_name",'',' ' +
> rtrim("dba"."examinee"."last_name"))) AS
> examinee_fullname,

> 'master.dbo.IFNULL' is an in house function for
> concatenating names. Would there be something in
> the SQL code processing itself that would 'see'
> the apostrophe and cause the error?

> Any ideas appreciated.  Thanks in advance.

> Duane Birrell



Sat, 29 May 2004 06:03:57 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. invalid - invalid character error

2. Invalid Character (I think)

3. invalid characters in sql statements

4. sp_xml_preparedocument (invalid character)

5. Invalid character value for cast specification

6. Stored Procedure reports-Invalid character value for cast Specification

7. how to find "invalid character cast"?

8. schema error: invalid character

9. Invalid Character error using SQLXMLBulkLoad

10. Invalid Character value for cast specification (#0)

11. Invalid Character Value

12. Invalid character value for cast specification


 
Powered by phpBB® Forum Software