时间:2021-07-01 10:21:17 帮助过:3人阅读
欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入 my $cols=$dbh2 - prepare($sql); $cols-execute(); my $cols_str = ""; my $n=0; $sort_column=""; while(@col= $cols-fetchrow_array()) { ($col_name,$type_name,$max_length,$preci
欢迎进入Windows社区论坛,与300万技术人员互动交流 >>进入
my $cols=$dbh2 -> prepare($sql);
$cols->execute();
my $cols_str = "";
my $n=0;
$sort_column="";
while(@col= $cols->fetchrow_array())
{
($col_name,$type_name,$max_length,$precision,$scale,$is_nullable,$is_identity)=@col;
if($is_identity == 1)
{
$ok=1;
$sort_column="$col_name";
}
}
}
sub do_sql
{
print '开始创建'.$_[0].'表的索引'.$_[1]."\n";
my $sql_create="CREATE UNIQUE INDEX $_[1] ON $_[0] ($_[1])";
my $dbh_mssql=DBI->connect("dbi:ODBC:$source_name",$source_user_name,$source_user_psd,{RaiseError =>1});
$dbh_mssql->{LongTruncOk}=1;
$dbh_mssql->{LongReadLen}=1048576;
my $sth_select=$dbh_mssql->prepare($sql_create);
# open(FILE,"》all_export_data222.txt");
# syswrite(FILE,"$sql_select\n");
# close(FILE);
$sth_select->execute() or die 'Cannot execute: '. $sth_select->errstr();
print '创建'.$_[0].'表的索引'.$_[1].'结束'."\n";
}
[1] [2]