Solved

SQL - Create a temporay table

Posted on 2007-12-05
1
177 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
Comment Utility
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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now