#!/usr/bin/perl
use strict;
use DBI;
use Data::Dumper;
use Asterisk::AGI;
my $agi = new Asterisk::AGI;
my $extension = '8315';
my $cti = '7702009896';
my $service_id =1;
my $DSN = q/dbi:ODBC:SQLSERVER/;
my $uid = q/ivr/;
my $pwd = q/ivr/;
my $DRIVER = "Freetds";
my $dbh = DBI->connect($DSN,$uid,$pwd) or die "Coudn't Connect SQL";
my $sql3=(qq{
declare '@' + callnumber as int
set '@' + callnumber = $callnumber
set '@' + callnumber = (Select '@'+'@' + identity)
exec "insert into rpt_call_detail (call_start_time,call_number,call_service_id,call_step_name,call_step_type,call_step_discription) values(getdate(),'@' + callnumber,$service_id,'START',0,'CLI:' + $cli)"
});
my $call_insert1 = $dbh->prepare($sql3);
$call_insert1->execute();
Perlスクリプト内でSQLサーバー変数を設定するには? callnumber を @@identity として設定したいのですが、上記のコードを正常に実行できません。助けてください。