in reply to Re: Yet Another Stored Procedure Question
in thread Yet Another Stored Procedure Question
For those as unfamiliar with stored procs as I am, @@identity on MS SQL returns the last selected identity-type field (ie: autonumbering) in the previous action. Here is the perl code which drops off data and picks up the auto-number field.CREATE PROCEDURE TestProc @InField varchar(50) AS INSERT INTO TestTable (InField) VALUES (@InField) SELECT @@identity GO
Not the prettiest piece of code, but hopefully it's basic enough to be clear to somebody looking to accomplish the same thing...connect to db.. my $sth = $dbh->prepare('{call TestProc(?)}'); my $a = "TEST"; $sth->bind_param(1, $a) or die $sth->errstr; $sth->execute(); my $results = $sth->fetch(); $sth->finish(); $dbh->disconnect; print "results are $$results[0]\n";
|
|---|