Solved

Populating a drop down list box

Posted on 1998-11-17
12
201 Views
Last Modified: 2010-03-19
How can I populate a drop down list box with the last 10 entries in a column?
0
Comment
Question by:mpreuett
  • 4
  • 2
  • 2
  • +3
12 Comments
 
LVL 2

Expert Comment

by:odessa
ID: 1091861
Dorp down list in which program or tool?
0
 

Author Comment

by:mpreuett
ID: 1091862
Adjusted points to 500
0
 

Author Comment

by:mpreuett
ID: 1091863
On a web page that I want to use for a small questionaire on an intranet.  I use MS-SQL 6.5 and Netscape SuiteSpot Enterprise Server.
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 2

Expert Comment

by:odessa
ID: 1091864
see coment to your previos Q
0
 

Expert Comment

by:fox_dogg
ID: 1091865
Well. You did not give much info.
What do you mean by last ten entries in a column.

If you mean the last ones added  you need to know the table.
Does it have a Identity column?
If so you could do something like:
select col from table where identity_column>(select max(identity_col)-10 from table)

Thus this would give you the last ten entered.

If using a timestamp field.
You can use the same code above exactly.
Replacing identiy_column with your timestamp_col name
However, this will give you the last ten columns that were changed!


If using a field that inserts the date . Use the same code and that column.

Hope that gives you a clue.
On SQL Server7. you can use the web assistant for HTML

With more information I can give you a better answer.

0
 
LVL 2

Expert Comment

by:aliciaam
ID: 1091866
You may have to implement a stored procedure using cursors. It depends on how you want that information.
0
 

Author Comment

by:mpreuett
ID: 1091867
Here is exactly what I am trying to do.  I have a database with  some varchar columns.  Throuh a webpage on our intranet I am having people fill those in.  What I want to be able to do is put a drop down list box above each one of those fields populated with the last ten entries to the column for people to select and enter into the column without having to type it in.  I am using a timestamp field as the key.  I'm not having a problem inserting the info into the db, that's easy, I just don't know how to populate the dropdown box with the last ten entries.  What other information do i need to supply?
0
 
LVL 1

Expert Comment

by:csalves
ID: 1091868
Did you have tried to select the MAX. 10 Rowid's.

bye
0
 
LVL 2

Expert Comment

by:aliciaam
ID: 1091869
If you use an identity column you can pinpoint the last row entered and then select while identity column last minus ten up to last with a while construct statement populate the results set.
Let me know if you need more info on identity or the while construct.
0
 
LVL 3

Expert Comment

by:cognition
ID: 1091870
You can also use the SET ROWCOUNT n. Where n is the number of rows to return. Then use SET ROWCOUNT 0, to return to the default. SET ROWCOUNT causes SQL server to stop processing a query afterr a certain number of rows have been returned. Note it also affects triggers and other SQL statements that occur until it is reset.

Using an identity column, may cause spurious results if rows are deleted, and the programming may be more complex.

SET ROWCOUNT 10

SELECT varchar
FROM Table
ORDER BY TimeStamp DESC

SET ROWCOUNT 0



0
 

Author Comment

by:mpreuett
ID: 1091871
Figured it out...  Thanks...
0
 
LVL 3

Accepted Solution

by:
cognition earned 500 total points
ID: 1091872
I should have answered it then not commented!
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hyperlink data type in SQL 3 28
Help Required 3 97
SQL Improvement  ( Speed) 14 28
Sql Query 6 67
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question