sorry for inconvinience
Im using operating system: Windows XP
database driver: DBD::ODBC
i want give customer name as input to the procedure (Ex-procedure name) and it checks whether the name is already present in the table and insert the customer name if it is not in the table.
here is sample code
#!/usr/local/bin/perl
use DBI;
use DBD::ODBC;
my $dbh = DBI->connect("dbi:ODBC:dsnentry", '', '', {PrintError => 0})
+;
die "Unable for connect to server" unless $dbh;
$dbh->{odbc_SQL_ROWSET_SIZE} = 2;
$query="Exec ex 'habibrahman'";
my $result=$dbh->prepare($query) or print "cannot prepare" ;
$result->{LongReadLen}=512*1024;
$result->{LongTruncOk}=1;
$result->execute() or print $result->errstr();
and here is my procedure
create procedure ex (@name varchar(200))
as
declare @cust_id int
where cust_name=@name
if(@cust_id='')
begin
insert into x(cust_name) values(@name)
end
GO
Edited by planetscape - added code tags
|