ODBiC Discussion Board


RE: There is still problem, Gordon Hsu, 07-23-2006

Need to replace those in the variable

by Roger Harris, July 23, 2006 08:42

In SQL, any apostrophes inside an apostrophe-quoted value need to be replaced with a pair of apostrophes. ODBscript normally does that for you automatically when you use a variable in an SQL statement such as Column='$var$' (or your SQL StoredProcName '$Var$' statement). However, in this case, it seems the $IF(...) with a quoted apostrophe followed by a variable is confusing that special processing, and it isn't happening. So, you will need to explicitly replace any apostrophes in the value with a pair of apostrophes, which can be done with the $repl(...) function:

<!--SQL StoredProcName $IF($Var$,"'"$repl($Var$,"'"="''")"'",NULL) -->
That's a bit obtuse, but it works. Perhaps it would be nice to add a new special function that knows how to return either NULL or a properly quoted value for use in SQL statements.

Replies:


Post Your Reply:

Name   
E-mail  optional
Topic  
Message:

HTTP Link: 
Link text: 

          


Copyright ©1997-2003, Roger Harris. All rights reserved.