Home > Database > Mysql Tutorial > body text

sqlserver数据导入mysql四:给sqlserver中的表创建索引

WBOY
Release: 2016-06-07 15:51:40
Original
1022 people have browsed it

欢迎进入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] 

sqlserver数据导入mysql四:给sqlserver中的表创建索引

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template