|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
create tables with dynamic names...can I do that?
hi,
I'm doing coldfusion dev. with oracle in the backend. I need to create several tables and use each for certian purpose. But I need to name these tables based on certain fiscal years in the future dates. So, here is what I have: <cfquery name="tbl_name" datasource="#DSN#" > create table #table_name#( col1 NUMBER(4), col2 VARCHAR2(20), col3 VARCHAR2(30), col4 VARCHAR2(1) ) </cfquery> But when I replace table name with my variable, oracle does not create the table. It does it only when I have a static name for table. Is there a way??? Many tahnks in advance |
|
#2
|
|||
|
|||
|
Are you getting any error when you use a variable name, cos the code looks fine to me. Just out of curosity, and I might be completely wrong, try using <cfoutput></cfoutput> on around the variable name.
|
|
#3
|
|||
|
|||
|
Looping is the key - but be sure to use `backticks` in Oracle/SQL/MySQL
I would do this for an example year span of 2001-2004 (or the current year dynamically). <cfloop from="2001" to="#dateformat(now(), "yyyy")#" index="i"> <cfquery datasource="#datasource#"> create table `#i#` col2 VARCHAR2(20), col3 VARCHAR2(30), col4 VARCHAR2(1) </cfquery> </cfloop> Marc Software Engineer support@ColdFusionCart.com Cold Fusion Shopping Cart |
|
#4
|
|||
|
|||
|
Is the name of the table coming from a form? Also, I have had some issues with naming variables with the underscore. Maybe the _name is confusing coldfusion. Try something that is not so regular. And of course if you are coming from a form to this page, use the #form.variablename#
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > create tables with dynamic names...can I do that? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|