Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

seek row?

Status
Not open for further replies.

delphidestructor

Programmer
Oct 20, 2000
67
Can anyone help? This seemed like simple task at first.

I have a table

f1 | f2
----------
xx | 11
yy | 22
zz | 33

I want to select all rows but have the
current record to be somewhere other than
the first record. Do I use a index seek function
and if so what is the syntax, parameters, etc?

Mike
 
That's controlled by the app, not the recordset. I don't think you're talking about a cursor.
-Karl
 
From what I have read I need to stay away from cursors. It may be an application solution to the problem. I just wanted to see what the best way to handle this would be. I guess I want to simulate a transactional engine. Where you would get the closest match on a particular field, say the last name of a customer, set the current record to the closest match and then be able to navigate forward and backwards on a table sorted on the last name until the user finds the correct customer.

Mike
 
With SQL Server you can write Stored Procedures (SP) which are precompiled T-SQL statements that can be so sophisticated that you could consider them programs in themselves.
For the seniero that you describe, you could write a SP that took an input parameter of a search string. The SP could be designed to return a recordset of potential matches. It could even rank (and sort) them based upon some criteria that you assign.
You will find that T-SQL is an extremely powerful tool in the programer's toolbox. You'll also discover that this is a terrific forum where you can pick-up some very useful tips.
Good luck :)
-Karl
BTW, for as long as possible, stay away from cursors, triggers and user defined functions...not necessarily in that order!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top