Applies to: MSSQL stored procedures called through PROP:SQL; the thread names no Clarion or SQL Server version.
Problem
Two stored procedures are used to fill a queue shown in a list box. The call is built as a string, for example 'call readProjProps_1(' & startId & ', ' & endId & ')', assigned to access:testtable.file{prop:sql}, and the result set is read with a NEXT loop that adds to the queue. The first procedure, with two int parameters that it passes on to sp_executesql, works. The second one does not. The text of the second call is not in the archived thread.
Solution
- Check the call string for parameters that are strings. They need quote marks (apostrophes) around them in the SQL text you build.
- The original poster reported that missing quote marks were the cause. They were needed around both parameters.
- In Clarion source an apostrophe inside a string literal is written doubled, or as
<39>.
Caveats
- One poster noted that the second procedure uses dynamic SQL, which follows different rules from precompiled SQL, and that the first would be more efficient because it is precompiled. This was not the cause here.
- The first procedure passes its int parameters straight through, which is why it needed no quotes.
Today (2026)
Likely unchanged: a string value built into a SQL text needs delimiters. Not re-tested.
Sources: Dennis E. (Jan 2009, the question), Sean H., John G. (Jan 2009) in softvelocity.clarion.databasedrivers.