Skip to main content
Inspiring
Dec 15, 2011 2:43 PM UTC
Answered

Alter Table

Hi everybody,

I would like to alter a table within a Coldfusion application. Can I do that with cfscript ? If, does anybody know how I can do that ?

Thanks.

This topic is closed to new replies. Start a new post to keep the conversation going.
Adam Cameron.Correct answer
Inspiring
Dec 15, 2011 3:12 PM UTC

Is there a cfscript equivalent for the CFQUERY Tag ?

Yup: Query.cfc:

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSe9cbe5cf462523a0693d5dae123bcd28f6d-7ffb.html

--

Adam

6 replies

Community Expert
Dec 15, 2011 2:55 PM UTC

If you want to alter a database table, you can use CFQUERY to run that, just like you use it to run standard SQL DML (SELECT, INSERT, UPDATE, DELETE) commands. That kind of SQL command is called DDL.

That said, you generally don't want to run DDL commands from applications for both security and common-sense reasons, and your database login will need a higher level of privilege to do this than it would to run DML commands.

Dave Watts, CTO, Fig Leaf Software

Translate
Dave Watts, Eidolon LLC
crikosAuthor
Inspiring
Dec 15, 2011 3:09 PM UTC

THank you very much for your answers,

what I want to do is to build an Air Application for maintaining my Tables in a Mysql system. If you know Ruby on Rails, there you have a Feature called "Migrations" - that's what I want to do with that application. It is not planned as a "normal" application, it should make it easier to keep the different versions between the development and production Environment up to date.

Is there a cfscript equivalent for the CFQUERY Tag ?

Regards

Translate
Owainnorth
Inspiring
Dec 15, 2011 3:11 PM UTC

There is in ColdFusion 9, yes.As long as you have permissions, it's just the same as running any other query.

Translate
Owainnorth
Inspiring
Dec 15, 2011 2:45 PM UTC

What kind of table? A database table? Why would you want to do that through ColdFusion?

Translate