说实话,也不想多说。运行->cmd->进入提示符下然后cd进入'disc:\Program Files\Microsoft SQL Server\MSSQL\Binn>'目录敲入textcopy,跟着提示一步一步操作就行了。不明白的地方看下边;)
上传交互(cmd)操作如下:
2 TEXTCOPY Version 1.0
3 DB-Library version 8.00.194
4 Type the SQL Server to connect to: 220.**.**.*
5 Type your login: sa
6 Type your password: sa
7 Type the database: Product
8 Type the table: Image
9 Type the text or image column: da
10 Type the where clause: where id=16
11 Type the file: c:\abc.gif
12 Type the direction ('I' for in, 'O' for out):I
13 Da
2 TEXTCOPY Version 1.0
3 DB-Library version 8.00.194
4 Type the SQL Server to connect to: 220.**.**.*
5 Type your login: sa
6 Type your password: sa
7 Type the database: Product
8 Type the table: Image
9 Type the text or image column: da
10 Type the where clause: where id=16
11 Type the file: c:\abc.gif
12 Type the direction ('I' for in, 'O' for out): O
13 Da
1、建立过程CREATEPROCEDURE sp_textcopy (
@srvnamevarchar (30),
@loginvarchar (30),
@passwordvarchar (30),
@dbnamevarchar (30),
@tbnamevarchar (30),
@colnamevarchar (30),
@filenamevarchar (30),
@whereclausevarchar (40),
@directionchar(1)
)AS
Begin
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
EXEC master..xp_cmdshell@exec_str
End
2、建表和初始化数据
createtable 表名 (编号int,image列名image)goinsert 表名 values(1,0x)-- 必须的,且不是null
insert 表名 values(2,0x)-- 必须的,且不是nullgo
3、读入sp_textcopy'你的服务器名','sa','你的密码','库名','表名','image列名','c:\图片.bmp','where 编号=1','I'--注意条件是 编号=1
sp_textcopy'你的服务器名','sa','你的密码','库名','表名','image列名','c:\bb.doc','where 编号=2','I'--注意条件是 编号=2
go
4、读出成文件sp_textcopy'你的服务器名','sa','你的密码','库名','表名','image列名','c:\图片.bmp','where 编号=1','O'--注意条件是 编号=1
sp_textcopy'你的服务器名','sa','你的密码','库名','表名','image列名','c:\bb.doc','where 编号=2','O'--注意条件是 编号=2
go
如果报textcopy不是可执行文件的话,你就到
C:\Program Files\Microsoft SQL Server\MSSQL\Binn
目录下拷备 textcopy.exe到:
C:\Program Files\Microsoft SQL Server\80\Tools\Binn
2487




被折叠的 条评论
为什么被折叠?



