Ask a Question related to Coldfusion Database Access, Design and Development.
-
Merlyn MM #1
check if the table is already existing
I need to check if the table is already existing in the database before
creating a new table dynamically. If the table is already there then I have to
display the table columns and the datatypes. Can anyone help me how can i do
this?
Merlyn MM Guest
-
Creating A New Table In Existing Access Database
Hi, I am trying to create a new table in an existing database and having some issues. When I use the attached code, it gives me an: Error... -
Creating new table with same structure as existing one
I need to create "archive" table that will have the same structure as "production" one. When I run my program it have to create table named... -
Default Date and/or Times in Form to Existing Records of Table
Fields are blank in the table. Want the default current date and times in fields upon entry of additional data in other blank fields. How can I... -
db2dart and check table
(1). DB2 UDB Personal Edition does not support remote connections, only allow local connections. (2). Either part of a table or some tables got... -
How to place a new table around an existing one?
I'm using DW MX on a powerbook. How do I place an existing table structure inside a new table? Or to put in another way how do I wrap a new table... -
mxstu #2
Re: check if the table is already existing
Another option would be to use CFPARAM to ensure that the form field values
exist.
Since FORM is a structure, you can also use this syntax instead of evaluate:
#form["Tour"& ThisRow]#
I noticed the single quotes around most of the values in the query. Are
"NumberAttending", "Tour", "Mixer", etc... "text" columns? If so, you might
want to use column data types that more accurately reflects the kind of values
contained in each column (in this case numeric and yes/no). For example, if
"NumberAttending" should only contain numbers, then the column type should
really be numeric not text. You probably wouldn't want someone entering "I am
bringing my entire extended family!" in the "NumberAttending" column : )
mxstu Guest
-
mxstu #3
Re: check if the table is already existing
There are probably a few methods for accommplishing this, but the specifics
depend on the type of database you are using. For example, SQL Server provides
"views" of system information like table objects and table columns, which can
be used to determine if a table exists or to retrieve information about table
columns.
-- should be modified to filter on database and table owner
IF NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME =
'YourTable')
BEGIN
-- some code here...
END
ELSE
BEGIN
SELECT COLUMN_NAME, DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'YourTable'
END
For security and other reasons, you may want to establish a special user/login
in the database and grant it limited permissions for working with the dynamic
objects. There are probably a number of both pros and cons to allowing an
interface to dynamically create database objects, so you may want to
investigate that aspect further.
HTH
mxstu Guest



Reply With Quote

