1、建立下面的过程:
CREATE PROCEDURE sp_textcopy (
@srvname varchar (30),
@login varchar (30),
@password varchar (30),
@dbname varchar (30),
@tbname varchar (30),
@colname varchar (30),
@filename varchar (30),
@whereclause varchar (40),
@direction char(1))
AS
DECLARE @exec_str varchar (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 2、建立你的表
create table 表名 (编号 int,image列名 image)
go3、初始化数据
insert 表名 values(1,0x)
insert 表名 values(2,0x)
go4、插入.swf
sp_textcopy '你的服务器名','sa','你的密码','库名','表名','image列名','c:\图片.swf','where 编号=1','I' --注意条件是 编号=1sp_textcopy '你的服务器名','sa','你的密码','库名','表名','image列名','c:\bb.swf','where 编号=2','I' --注意条件是 编号=25、导出
sp_textcopy '你的服务器名','sa','你的密码','库名','表名','image列名','c:\图片.swf','where 编号=1','O' --注意条件是 编号=1sp_textcopy '你的服务器名','sa','你的密码','库名','表名','image列名','c:\bb.swf','where 编号=2','O' --注意条件是 编号=2
go
CREATE PROCEDURE sp_textcopy (
@srvname varchar (30),
@login varchar (30),
@password varchar (30),
@dbname varchar (30),
@tbname varchar (30),
@colname varchar (30),
@filename varchar (30),
@whereclause varchar (40),
@direction char(1))
AS
DECLARE @exec_str varchar (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 2、建立你的表
create table 表名 (编号 int,image列名 image)
go3、初始化数据
insert 表名 values(1,0x)
insert 表名 values(2,0x)
go4、插入.swf
sp_textcopy '你的服务器名','sa','你的密码','库名','表名','image列名','c:\图片.swf','where 编号=1','I' --注意条件是 编号=1sp_textcopy '你的服务器名','sa','你的密码','库名','表名','image列名','c:\bb.swf','where 编号=2','I' --注意条件是 编号=25、导出
sp_textcopy '你的服务器名','sa','你的密码','库名','表名','image列名','c:\图片.swf','where 编号=1','O' --注意条件是 编号=1sp_textcopy '你的服务器名','sa','你的密码','库名','表名','image列名','c:\bb.swf','where 编号=2','O' --注意条件是 编号=2
go
C:\Program Files\Microsoft SQL Server\MSSQL\Binn
目录下拷备 textcopy.exe到:
C:\Program Files\Microsoft SQL Server\80\Tools\Binn
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 前面的参数分别是什么意思呀。' /U ' ~' /'
[/D ][database]] [/T table] [/C column] [/W"where clause"]
[/F file] [{/I | /O}] [/K chunksize] [/Z] [/?] /S sqlserver The SQL Server to connect to. If 'sqlserver' is n
ot
specified, the local SQL Server is used.
/U login The login to connect with. If 'login' is not spec
ified,
a trusted connection will be used.
/P password The password for 'login'. If 'password' is not
specified, a NULL password will be used.
/D database The database that contains the table with the tex
t or
image data. If 'database' is not specified, the d
efault
database of 'login' is used.
/T table The table that contains the text or image value. /C column The text or image column of 'table'.
/W "where clause" A complete where clause (including the WHERE keyw
ord)
that specifies a single row of 'table'.
/F file The file name.
/I Copy text or image value into SQL Server from 'fi
le'.
/O Copy text or image value out of SQL Server into '
file'.
/K chunksize Size of the data transfer buffer in bytes. Minimu
m
value is 1024 bytes, default value is 4096 bytes. /Z Display debug information while running.
/? Display this usage information and exit. You will be prompted for any required options you did not specify.