Solved

SQL - Create a temporay table

Posted on 2007-12-05
1
201 Views
Last Modified: 2013-12-24
I need help creating a temporary MS SQL 2000 table in coldFusion. I keep having trouble with the syntax.  The "#" sign is giving me trouble. When i remove the "#" sign it creates an actual table in the DB.

<cfquery name="createTempTable" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
CREATE TABLE #tmp_report_table
(      name      VARCHAR(30),
      id      VARCHAR(30),
)
</cfquery>
0
Comment
Question by:Wirt
1 Comment
 
LVL 36

Accepted Solution

by:
SidFishes earned 500 total points
ID: 20413321
couple of things

you've an extra comma at end of id      VARCHAR(30), <----
and you need to escape the # with ## for CF to not throw an error


<cfquery name="createTempTable" datasource="#dbname#" username="#dbuser#" password="#dbpw#">
CREATE TABLE ##tmp_report_table
(      name      VARCHAR(30),
      id      VARCHAR(30)
)
</cfquery>
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question