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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i search the next register after the last one from a column

Status
Not open for further replies.

Edimator

IS-IT--Management
Mar 13, 2001
49
0
0
VE
Hi everyone i need a help from you.
I am trying to search the next register after the last one, because i need to show it automatically in a input text created by html, before the user create a new count.
The code make me an error

The lines below describe the search:
declare @letracuenta varchar
declare @cuenta varchar(10)

set @letracuenta='x'

select top 1 @cuenta=cuenta from cuenta
where left(cuenta,1)=@letracuenta order by cuenta desc

select substring (@cuenta,2,10),(@cuenta )+1

I woul really apreciate your help!
 
I would try this:

select @cuenta = (Select TOP 1 cuenta from cuenta
where left(cuenta,1) = @letracuenta order by cuenta desc)

-------------------------
Hopefully, I dod not make a syntax error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top