Ask a Question related to Coldfusion Database Access, Design and Development.
-
CF_starter #1
Empty data tables - Check
How can I check to see if a data table is empty so that I can set the ID value the first time?
thanks
CF_starter Guest
-
Check Empty form fields
Hi all, Is there a simple extension that checks so that a form filed is not empty before submitting? -
How do you check for empty results
I am pulling some XML in from PHP. Everything works fine until there are no results. My XML is formed like this: <books> <book> <title>Book... -
Why does CT drop empty lines in tables
One of the pages on my clients website doesn't publish properly. My client does the updates using CT3. The page update is a simple cut and paste... -
check if querystring is empty
if Request.QueryString("sub1")="" then 'it's empty else 'it's something end if "Thomas Henz" <thenz@t-online.de> wrote in message... -
RegularExpressionValidator - check for empty field
Hi all, I want to use RegularExpressionValidator to enforce non-empty integer format in a TextBox. However, the validator doesn't give the error... -
mxstu #2
Re: Empty data tables - Check
I assume "ID" is not some sort of auto incrementing record ID column?
It depends on your database. In an ms sql database, you could use "if not
exists ...". You could also count the number of records in the table and if it
is zero, execute some code.
--- ms sql database
if not exists (select someColumn from yourTable)
begin
do something here...
end
mxstu Guest
-
Dan Bracuk #3
Re: Empty data tables - Check
select count(id) as thecount from mytable
I assume you have a plan for setting the id field the first time, and incrementing it.
Dan Bracuk Guest
-
chuckbeckwith #4
Re: Empty data tables - Check
You probably need to know what the ID is for your programming.
Try looking up @@identity. It will tell you the ID AFTER the insert query.
chuckbeckwith Guest
-
CF_starter #5
Re: Empty data tables - Check
Yes, I do have a plan for setting the record. I am going use MS-SQL 2000 as
the finished product. Right now I'm testing with MS-Access. I'm just trying to
figure out how to do it, I tried MAX but got no value back.
g
CF_starter Guest
-
mxstu #6
Re: Empty data tables - Check
If you are using Access and migrating to SQL Server, why not just use an
autonumber column and run SELECT @@IDENTITY after your inserts like
chuckbeckwith suggested? (Note - You will need to wrap both the INSERT and
SELECT @@IDENTITY queries in a CFTRANSACTION) Then when you migrate to SQL
Server the autonumber column will likely become an identity column and you can
use one of SQL Server's identity functions.
mxstu Guest



Reply With Quote

