In Oracle (or any database that supports sequences) you can select the
current value from a sequence without incrementing it.
In MS SQL Server I'd use a trigger on the table
CREATE TRIGGER keepcount_mytable ON mytable
FOR INSERT AS
UPDATE mycounttable
SET currentcount = currentcount + 1
WHERE tablename = mytable;
Then you can get the count from your table by
selecting the currentcount column from the
counttable table
With MySQL or MS Access you'll probably have to resort to keeping the
count externally unless you want to use an aggregated query (which
will require more overhead). It's fairly easy to do this with cffile
actually. I've got some sequence features in the onTap framework that
I use for hit counters on my site using cffile.
hth
s. isaac dealey 214-823-9345
team macromedia volunteer http://www.macromedia.com/go/team
chief architect, tapestry cms http://products.turnkey.to
onTap is open source http://www.turnkey.to/ontap
> Anyway to increment a number to a field when a new record
> is inserted? I want to keep a counter of the number of
> records.
> Robert (HWW)
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

