Create a database, or create a table in an existing dsn (i.e. database?)

To create a table, for example, you would do something like the code below.  The table name and one field are passed vars.  You can get fancy with the varnames or not as you please.

Hope this helps,

<cfset variables.myTable="OnTheFly">
<cfset variables.myFieldName="myOhMy">
<cfquery
datasource="#request.NewDSN#">
CREATE TABLE #variables.myTable#
(
  ID COUNTER not NULL PRIMARY KEY,
  #variables.myFieldName# number NULL,
  RevisionID number NOT NULL,
  PostDate datetime NULL ,
  Title text(255) NULL ,
  PageText memo NULL ,
  Approved text(1) NULL
);
</cfquery>
<cfquery
datasource="#request.NewDSN#">
CREATE INDEX #variables.myFieldName# on #variables.myTable#(#variables.myFieldName#);
</cfquery>


--
-------------------------------------------
Matt Robertson,     [EMAIL PROTECTED]
MSB Designs, Inc. http://mysecretbase.com
-------------------------------------------

--
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to