Hiya guys, I'm not sure if this is a Perl or SQL question but I thought someone should be able to point me in the right direction.
I have a table in my database (tbl_Meeting) with three fields; MeetingUID, ME_Course, ME_Date.
Basically all I'm trying to do is insert a record into an SQL database using the standard query, but I want to return the primary key MeetingUID without having to requery the database. I have an equivalent VB version (see below) but how do I return the MeetingUID into a variable in my Perl script.
My code so far:
can I use fetchrow_array in order to retireve the MeetingUID:
Rob Waite
I have a table in my database (tbl_Meeting) with three fields; MeetingUID, ME_Course, ME_Date.
Basically all I'm trying to do is insert a record into an SQL database using the standard query, but I want to return the primary key MeetingUID without having to requery the database. I have an equivalent VB version (see below) but how do I return the MeetingUID into a variable in my Perl script.
Code:
strSQL = "Set Nocount on INSERT INTO tbl_Meeting (ME_Course,ME_Date) VALUES (?,?) select IdentityInsert=@@MeetingUID set nocount off"
Set objRS = objConn.Execute(strSQL)
Response.Write objRS("IdentityInsert")
My code so far:
Code:
$dbh = &sqlConnect;
my $sth = $dbh->prepare(q{Set Nocount on INSERT INTO tbl_Meeting (ME_Course,ME_Date) VALUES (?,?) SELECT MeetingUID=@@MeetingUID set nocount off}) or die $dbh->errstr;
$sth->execute($ME_Course,$ME_Date) or die $dbh->errstr;&sqlDisconnect($dbh);
can I use fetchrow_array in order to retireve the MeetingUID:
Code:
@row_ary = $sth->fetchrow_array;
$MeetingUID = @row_ary[0];
Rob Waite