Hi,

I wanted to add this to the mailing list archive for MS SQL Server (I've
listed other useful email messages at the end of this note).  This might be
a bug, any comments?

When I used Torque 3.0 dev (standalone) to generate  SQL queries based on
multiple tables, the SQL gave me one of these error messages in SQL Server
2000:

   The variable name '@reftable' has already been declared. Variable names
must be unique within a query batch or stored procedure.

   The variable name '@constraintname' has already been declared. Variable
names must be unique within a query batch or stored procedure.

Turns out that the generated SQL script does not work properly when you dump
it all into Query Analyzer at once.  In particular, each table declares
local variables "reftable" and "constraintname".  Dumping the entire SQL
script (with all the table defs) into the SQL Query Analyzer gave me this
error as the references were redeclared for each table.

The solution was to manually edit the script, doing a search/replace (whole
word) changing "reftable" to "reftable1" in the first table, "reftable2" in
the second table, etc.  Then I did the same thing for "constraintname".
Caution-- be careful not to change the keyword "reftables".

WILL

References:

http://jakarta.apache.org/turbine/howto/mssql-howto.html

http://www.mail-archive.com/[email protected]/msg05744.html

http://www.mail-archive.com/[email protected]/msg01677.html

http://www.mail-archive.com/[email protected]/msg01677.html


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to