?
Solved

SQL - Create a temporay table

Posted on 2007-12-05
1
Medium Priority
?
229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 36

Accepted Solution

by:
SidFishes earned 2000 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

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