I'm editing a program which will run a set of .sql batch statements. It uses the following code to connect to the database:
---------------------------------------------------------
use DBI;
use strict;
my $data_source="dbi:ODBC:$ENV{DSQUERY}";
# Connect to the db - retrieve db handle
my $dbh = DBI->connect($data_source,$ENV{SYBPRIVUSR},$ENV{SYBPRIVPWD}) or die $DBI::errstr;
# Switch to the environments db
my $sth = $dbh->prepare("USE $ENV{DBNAME}");
$sth->execute() or die $sth->errstr;
---------------------------------------------------------
With each line in the sql files, I have it load each segment of code before a GO statement to an array (to execute each segment seperately). The problem I'm having is that in the sql file, the statement sp_rename... will not run. It gives me errors like Invalid Curser position. I believe this is because the sp_rename statement returns a sucess/fail integer. If we can't get this to work, how else can I rename an object or column without using sp_rename and get the same exact results. If anyone could help me out, it would be greatly appreciated.
Tim
---------------------------------------------------------
use DBI;
use strict;
my $data_source="dbi:ODBC:$ENV{DSQUERY}";
# Connect to the db - retrieve db handle
my $dbh = DBI->connect($data_source,$ENV{SYBPRIVUSR},$ENV{SYBPRIVPWD}) or die $DBI::errstr;
# Switch to the environments db
my $sth = $dbh->prepare("USE $ENV{DBNAME}");
$sth->execute() or die $sth->errstr;
---------------------------------------------------------
With each line in the sql files, I have it load each segment of code before a GO statement to an array (to execute each segment seperately). The problem I'm having is that in the sql file, the statement sp_rename... will not run. It gives me errors like Invalid Curser position. I believe this is because the sp_rename statement returns a sucess/fail integer. If we can't get this to work, how else can I rename an object or column without using sp_rename and get the same exact results. If anyone could help me out, it would be greatly appreciated.
Tim