I have recently been given a great dbs to play with, SQL Server 2000.
Now this may not be big for most of you, but most of the development
work that I have done was in Access, and some in MySQL, but I have found
that one f the main views in SQL 2000, helpful in just about eliminating
all uses of writing queries again.
I call them database independent qry actions, and I have at least three
right now, I am currently working on one that will create tables on the
fly and append to the table design. My question is, has there been
anyone else to try to do this? And if so, do you have any success or
failuires to pass so that I can see if I may be able to over come any
problems before I run into any. My goal is to write a set of tags that
I would just use over and over again, and not have to worry about
writing anymore query tags, except maybe an occasional select * From
table where Id = #attributes.id#, queries.
Below is an example of one of the three independent qry actions I have
written, but not fully testes.
<!--- Column Name and data Attributes for the columns --->
<cfquery name="TableInfo" datasource="#request.DSN#">
SELECT Column_Name, Data_Type
FROM #request.SQLDSN#.Information_Schema.Columns
WHERE Table_Name = '#Attributes.Title#'
</cfquery>
<!--- Make the column names into a list --->
<cfset request.ColumnNames = ValueList(TableInfo.Column_Name)>
<!--- Insert Statement --->
<cftransaction>
<cf_Max_ID datasource="#request.DSN#" tablename="#TableName#"
primarykey="#Key#">
<cfquery name="MasterInsert" datasource="#request.DSN#"
dbtype="ODBC">
INSERT INTO #Title# (#request.ColumnsNames#)
VALUES (<cfset Test = ListLen(request.ColumnNames)>
<cfloop query="TableInfo">
<cfif DataType is not
"Numeric">'</cfif>#Evaluate('attributes.' & Column_Name)#<cfif DataType
is not "Numeric">'</cfif>
<cfif Test GT 1>
,
<cfset Test = Test - 1>
</cfif>
</cfloop>)
</cfquery>
</cftransaction>
Any help would be appreciated.
Donald R. Pavlik
[EMAIL PROTECTED]
Software Engineer
Inovation LLC.
www.inovation.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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