Reputation: 11120
ColdFusion uses #
's to delineate variables. In SQL Server a table name with #
or ##
is temp table and a global temp table respectively. How does one use SQL Temp tables in ColdFusion?
Upvotes: 3
Views: 2897
Reputation: 20804
Another alternative is to use stored procedures. You have to write all that t-sql somewhere and a stored procedure might make it easier for you.
Upvotes: -1
Reputation: 11120
ColdFusion treats shows ## as a single # in the output. Hence
<cfquery name="qryTempUser">
SELECT *
FROM ##tempUsers
WHERE Active_CODE = 1
</cfquery>
is pulling from a temp table called #tempUsers
<cfquery name="qryTempUser">
SELECT *
FROM ###myTableName#
WHERE Active_CODE = 1
</cfquery>
is pulling from a temp table called that is specified in a ColdFusion variable called myTableName
<cfquery name="qryTempUser">
SELECT *
FROM ####tempUsers
WHERE Active_CODE = 1
</cfquery>
is pulling from a global temp table called ##tempUsers
<cfquery name="qryTempUser">
SELECT *
FROM #####myTableName#
WHERE Active_CODE = 1
</cfquery>
is pulling from a global temp table called that is specified in a ColdFusion variable called myTableName
Upvotes: 3