List Info

Thread: insert statement




insert statement
user name
2006-01-25 12:25:22
hi all,
i ve a wbform with a button
in  the click event a sql querry is excuted
query is
insert into tbl(name,age)values('a',21)
tbl contain another filed "id" which is identity and primary key
 
i need to diaplay the "id" value of the above querry after inserting.
 ie on that button click event
like "you number is 1000"
how is it possible?
rply plz
thanks in advance

--
VipinDev S
 
insert statement
user name
2006-01-25 12:48:50
If you use SQL Server you can put insert into procedure
where you can
get "id" through SCOPE_IDENTITY()

Eg.:
create procedure add_tbl_record

name
nvarchar(100),
age
int

as

insert into tbl (name, age)
values (name, age)

select SCOPE_IDENTITY()

insert statement
user name
2006-01-25 12:59:15
hey marss thts really a important one
thanks

 
On 1/25/06, marss < marssukr.net">marssukr.net&gt; wrote:

If you use SQL Server you can put insert into procedure where you can
get "id&quot; through SCOPE_IDENTITY()

Eg.:
create procedure add_tbl_record

name nvarchar(100),
age int

as

insert into tbl (name, age)
values (name, age)

select SCOPE_IDENTITY()




--
--
Regards
Abhishek
insert statement
user name
2006-01-25 14:34:34
If you are using MySQL you can execute Select
LAST_INSERT_ID() on the
same connection and it will return the ID you are looking
for.

Rick

insert statement
user name
2006-01-27 05:13:43
thanks to all

On 1/25/06, RHolcomb < rholcombgmail.com">rholcombgmail.com> wrote:

If you are using MySQL you can execute Select LAST_INSERT_ID() on the
same connection and it will return the ID you are looking for.

Rick




--
VipinDev S
[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )