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

Max in a Store procedure

Status
Not open for further replies.

sujosh

Programmer
Joined
Nov 29, 2001
Messages
93
Location
US
I am trying to get the max of a int column and assign it to a variable to do a insert in that table with the new key. here is my code.. my question is how do I set the @trans_seq_num with what the column name?

declare @trans_seq_num int
SELECT max(trans_seq_num) FROM pv_trans

SET @trans_seq_num =
 
Hi,

Here is one way you can do it.

declare @trans_seq_num int
SELECT @trans_seq_num = max(trans_seq_num) FROM pv_trans

Kim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top