|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
在JOIN操作中(需要从多个数据表提取数据时),MySQL只有在主键和外键的数据类型相同时才能使用索引。server
在MSSQLSERVER安装目次下有个可实行文件叫TEXTCOPY.EXE
可对MSSQLSERVER中的文本或图象数据举行输出输入.
不外你能够在MS-DOS体例下实行textcopy/?失掉它的形貌。
上面是这个工具的形貌:
CopiesasingletextorimagevalueintooroutofSQLServer.Theval
ue
isaspecifiedtextorimagecolumnofasinglerow(specifiedbyth
e
"whereclause")ofthespecifiedtable.
IfthedirectionisIN(/I)thenthedatafromthespecifiedfileis
copiedintoSQLServer,replacingtheexistingtextorimagevalue.If
the
directionisOUT(/O)thenthetextorimagevalueiscopiedfrom
SQLServerintothespecifiedfile,replacinganyexistingfile.
TEXTCOPY[/S][sqlserver]][/U[login]][/P][password]]
[/D][database]][/Ttable][/Ccolumn][/W"whereclause"]
[/Ffile][{/I|/O}][/Kchunksize][/Z][/?]
/SsqlserverTheSQLServertoconnectto.Ifsqlserverisn
ot
specified,thelocalSQLServerisused.
/UloginThelogintoconnectwith.Ifloginisnotspec
ified,
atrustedconnectionwillbeused.
/PpasswordThepasswordforlogin.Ifpasswordisnot
specified,aNULLpasswordwillbeused.
/DdatabaseThedatabasethatcontainsthetablewiththetex
tor
imagedata.Ifdatabaseisnotspecified,thed
efault
databaseofloginisused.
/TtableThetablethatcontainsthetextorimagevalue.
/CcolumnThetextorimagecolumnoftable.
/W"whereclause"Acompletewhereclause(includingtheWHEREkeyw
ord)
thatspecifiesasinglerowoftable.
/FfileThefilename.
/ICopytextorimagevalueintoSQLServerfromfi
le.
/OCopytextorimagevalueoutofSQLServerinto
file.
/KchunksizeSizeofthedatatransferbufferinbytes.Minimu
m
valueis1024bytes,defaultvalueis4096bytes.
/ZDisplaydebuginformationwhilerunning.
/?Displaythisusageinformationandexit.
Youwillbepromptedforanyrequiredoptionsyoudidnotspecify.
为此,可写一个存储历程,挪用这个命令
CREATEPROCEDUREsp_textcopy(
@srvnamevarchar(30),
@loginvarchar(30),
@passwordvarchar(30),
@dbnamevarchar(30),
@tbnamevarchar(30),
@colnamevarchar(30),
@filenamevarchar(30),
@whereclausevarchar(40),
@directionchar(1))
AS
DECLARE@exec_strvarchar(255)
SELECT@exec_str=
textcopy/S+@srvname+
/U+@login+
/P+@password+
/D+@dbname+
/T+@tbname+
/C+@colname+
/W"+@whereclause+
"/F+@filename+
/+@direction
EXECmaster..xp_cmdshell@exec_str
上面是一个拷贝图象到SQLServer的pubs数据库的例子,表名pub_info,字段名
logo,图象文件名picture.bmp,保留到pub_id=0736纪录sp_textcopy@srvn
ame=ServerName,
@login=Login,
@password=Password,
@dbname=pubs,
@tbname=pub_info,
@colname=logo,
@filename=c:picture.bmp,
@whereclause="WHEREpub_id=0736",
@direction=I
在ORDERBY操作中,MySQL只有在排序条件不是一个查询条件表达式的情况下才使用索引。(虽然如此,在涉及多个数据表查询里,即使有索引可用,那些索引在加快ORDERBY方面也没什么作用)。 |
|