What would be the best way to delete the last item in a list?
Thanks
__
Get Your Own Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation · $99/Month · Free Setup
cfset listName = listDeleteAt(listName,listLen(listName))
Claudia Hoag wrote:
What would be the best way to delete the last item in a list?
Thanks
__
Get Your Own Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM /
TRY:
CFSET foo = listDeleteAt(list, ListLen(list,,), ,)
HTH,
Jeff Garza
-Original Message-
From: Claudia Hoag
To: CF-Talk
Sent: 2/17/02 3:02 AM
Subject: delete last in the list
What would be the best way to delete the last item in a list?
Thanks
I think part of the confusion was because in the original thread that I
responded to, it had been done as cfqueryinsert/cfquery
cfqueryselect/cfquery. I should have taken the extra couple of seconds
to write an example such as the one below.
-Original Message-
From: Paul Hastings
Is there any benefit to indexing a tinyint field that is used as a boolean
(either 1 or 0)? I have four fields that work this way and I use them
heavily in queries for reporting. They are used in aggregate functions
(count and sum) as well as in the where clauses for various queries.
I know I
Hey All.
Does anyone out there know of a way to dynamically grab the identity
column from a table in a select statement?
Example:
CFQUERY NAME=queryname DATASOURCE=dsn
SELECT @@IDENTITY_COLUMN
FROM TABLE_NAME
/CFQUERY
Where @@IDENTITY_COLUMN would be the function to obtain the value of
the
You could do it like this...
CFTRANSACTION
CFTRY
CFQUERY NAME=qryID DATASOURCE=#Application.DSN#
SET NOCOUNT ON
INSERT INTO foo (name)
VALUES ('Homer Simpson')
Scott - do you mean the identity value of a newly inserted record, or to
select the ID value when you don't know the name of the identity column?
-Original Message-
From: Scott Van Vliet [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 17, 2002 2:22 PM
To: CF-Talk
Subject: Dynamically
Does anyone out there know of a way to dynamically grab the identity
column from a table in a select statement?
if you mean the metadata for which column has an IDENTITY property, no.
but i suppose you could query the syscolumns' status column for IDENTITY
(0x80).
---
Outgoing mail is
CFTRANSACTION
CFTRY
since you have only one cfquery cftransaction's not going to be doing much
in this example.
CFQUERY NAME=qryID DATASOURCE=#Application.DSN#
SET NOCOUNT ON
INSERT INTO foo (name)
VALUES ('Homer Simpson')
SELECT PrimaryKey = @@IDENTITY
SET NOCOUNT OFF
/CFQUERY
Jeff - The second: select the ID value when you don't know the name of
the identity column...
Is this even possible?
Thanks!
-Original Message-
From: Jeff Beer [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 17, 2002 11:42 AM
To: CF-Talk
Subject: RE: Dynamically Obtaining IDENTITY
Scott - do you mean the identity value of a newly inserted record, or to
select the ID value when you don't know the name of the identity column?
you don't need to know the IDENTITY column to get @@IDENTITY.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system
I have come up with a hack solution:
DECLARE @IDCOLUMN varchar(50)
DECLARE @OBJ varchar(50)
DECLARE @OBJID int
DECLARE @STATEMENT varchar(50)
SET @OBJ = 'PRODUCTS'
SET @OBJID = OBJECT_ID(@OBJ)
SET @IDCOLUMN = COL_NAME(@OBJID,1)
SELECT @IDCOLUMN As IDColumn
Given that the identity column is
I'm looking for a really good web based editor to add to my server for my
clients, and segguestions?
Check out HTMLAREA by I-Automated:
http://www.iautomated.com/store/default.cfm?iid=2
There's also a single domain license version available named HTMLAREA_ONE:
Indexing any field that is used to search with on a regular basis is
always a good idea. For instance, I had a database full of users (about
27,000 of them) and the login process would take forever. Placing an
index on the username and password fields increases the query execution
speed by over
Image trying to lookup a phone number in the white pages if the entries
were in the order they were entered in to the database (ie...not in
alphabetical order). You would have to look through the entire phone
book to find any number. That's what your database has to do if you
don't use indexed
Well, if you just want to know the name of the first column in your table,
why don't you do a select * and then get the listfirst of
query.columnlist ?
such as
cfquery name=firstquery datasource=dsn maxrows=1
select * from yourtable
/cfquery
cfset yourcolumn =
Ooops
I meant
cfset yourcolumn = listfirst(firstquery.columnlist)
At 10:18 PM 2/17/2002 -0500, you wrote:
Well, if you just want to know the name of the first column in your table,
why don't you do a select * and then get the listfirst of
query.columnlist ?
such as
cfquery name=firstquery
I'm trying to figure a percentage in a query. I don't know if it's possible.
I would like to D_Loss / D_Goal and then output the percentage. I'm using an
Access database if that helps.
CFQUERY NAME=QDiet DATASOURCE=met
SELECT D_ID, D_Name, D_Loss, D_Goal
FROMdiet
ORDER BY diet.D_Name
Of course it is possible. Try
SELECT D_ID, D_Name, D_Loss/D_Goal*100 as MyValue
FROM diet
Then put a % after the output value. e.g. cfoutput#MyValue#/cfoutput%
- Original Message -
From: Ann Harrell [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Sunday, February 17, 2002 8:41 PM
Or if you wanted to let your SQL do everything:
select d_id,d_name, Convert(varchar(3), ((d_Loss/d_Goal) * 100)) + '%' as
Percent
from diet
order by d_name
You can use the Convert (or Cast, your preference) to change the math result
into a VarChar field and then append the % sign on all within
Thanks, Nathan. I didn't work for me, but that probably has more to do wi
th
the lateness of the hour than anything. I'll start fresh in the morning.
Ann Harrell
-Original Message-
From: Nathan Chen [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 17, 2002 11:01 PM
To: CF-Talk
Subject:
Ann,
This might not have worked if you have any zeros in the D_Goal column.
This would work for SQL Server, and should work for Access, but I'm not
sure.
SELECT D_ID, D_Name,
(CASE D_Goal WHERE 0 THEN 0
ELSE D_Loss/D_Goal*100) as MyValue
FROM diet
Steve
- Original Message -
Hi, All:
I have a program that requires user login(username, password). After
the users log in the system, I use a session variable to store the users
IDs and other users' data to determine whether they are allowed to visit
certain pages. I don't have the control over how long the users can
Steve is right. You can't have zero as the denominator. I totally forgot
about that. Sorry. Ann, it is very likely that some of your fields contain
zero values.
nathan
- Original Message -
From: Steven Durette [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Sunday, February 17,
Nathan,
You can override the server's default session timeout value by using
cfapplication and the tag's sessiontimeout attribute. Besides the server
default timeout, there's also a maximum timeout value set at the server
level. If you want to set it much higher than 20 minutes, you probably
Jim,
Thank you very much for the information.
nathan
- Original Message -
From: Jim McAtee [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Sunday, February 17, 2002 11:16 PM
Subject: Re: Session variable vs. other variables
Nathan,
You can override the server's default
Extending the sessions can be done a number of ways... You can use
JavaScript embeded in a page to connect to the server every now and then.
The end result is that a user stays logged in until they close thier
browser.
I found depressedpress.com's gif as a data pipe an excellent method. If
you
Joseph,
Thank you so much!
nathan
- Original Message -
From: Joseph Thompson [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Sunday, February 17, 2002 11:40 PM
Subject: Re: Session variable vs. other variables
Extending the sessions can be done a number of ways... You can use
This works as well, however, using SQL functions can be faster.
SELECT COL_NAME(OBJECT_ID('#tablename#'),1) As IDColumn
This does the job in one line (rather than the query, and then the list
function. ^_^
SV2
-Original Message-
From: Claudia Hoag [mailto:[EMAIL PROTECTED]]
Sent:
I actually found a good way to get the real Primary Key for a given
table, TABLENAME:
EXECUTE SP_PKEYS 'TABLENAME'
This will return a recordset with:
TABLE_QUALIFIER
TABLE_OWNER
TABLE_NAME
COLUMN_NAME (This is what I wanted)
KEY_SEQ
PK_NAME
Thanks for all of the insight!
-Original
31 matches
Mail list logo