I agree that it might look a lot cleaner doing it in CF, and I'd probably do
it that way too. My only point is that you _can_ do it with T-SQL, by
dynamically building the SQL statement and then calling it with Exec(). If
you need to pass an unknown number of parameters (e.g., sometimes you're
adding one column, sometimes two), it is possible with T-SQL, but it's much
easier and cleaner with CF, where you can use nice constructs like CFLOOP to
easily build your SQL, and then pass it via CFQUERY.
I guess I'm lucky that I have to do very little manipulation of the database
structures from within a CF app. I'm mostly dealing with reading and
writing data.
Bob
-----Original Message-----
From: Philip Arnold - ASP [mailto:[EMAIL PROTECTED]]
Sent: March 29, 2001 8:45 AM
To: CF-Community
Subject: RE: Stored procedures...when would you
> I both agree and disagree with Philip regarding building dynamic SQL. I
> cannot think of many cases where you _cannot_ do it in an SP, but
> if you are
> actually building your SQL statement from within the SP, then you lose one
> of the performance benefits of SPs (it cannot be pre-compiled).
Certain things are impractacle (sp?) in a SP, for example, if you want to
alter a table structure and have the field name/types dynamic, then this
wouldn't work at all properly in a SP;
alter table #myTableAlterations#
If this had all sorts of field type/length changes (e.g. VARCHAR to TEXT)
then you just wouldn't want to do this in a SP
I do this a lot as my table structures can be altered in the back offices -
I have a list of fields and types and the system adds/updates the fields to
the tables - means I can adjust loads of tables automatically just by
changing one tiny bit of code
Philip Arnold
Director
Certified ColdFusion Developer
ASP Multimedia Limited
T: +44 (0)20 8680 1133
"Websites for the real world"
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists