eclipse calls stored procedures
defines an order system based on sqlserver database. I want to call a stored procedure to automatically give a self-increasing order number in each order processing, but I don"t know how to write
in eclipse.related codes
/ / Please paste the code text below (do not replace the code with pictures)
-- create a table SEQ_SERIAL_NO
create table SEQ_SERIAL_NO (
seqid int identity(1,1) primary key, -- ID
seqval varchar(1) -- Sequence
)
-- create a stored procedure that gets the latest sequence value from the SEQ_SERIAL_ no table
create procedure SP_GetSeqVal
as
begin
-- Sequence
declare @NewSeqValue int
--
set NOCOUNT ON
-- SEQ_SERIAL_NO
insert into SEQ_SERIAL_NO(seqval) values ("a")
-- SequenceSeqT_0101001
set @NewSeqValue = scope_identity()
-- Sequence<999999999():"YYYY" +5Sequence(201019988)SQLServer
-- set @NewSeqValue = Convert(char(4),Getdate(),112) + right("00000"+CAST(scope_identity() AS varchar(5)),5)
-- Print @NewSeqVal "201019988" Sequence
-- SeqT_0101001()
delete from SEQ_SERIAL_NO WITH (READPAST)
-- Sequence
return @NewSeqValue
end
-- use Sequence
Declare @ NewSeqVal int
Exec @ NewSeqVal = P_GetSeqVal
Print @ NewSeqVal
Print Convert (char (8), Getdate (), 112)