7/15/2008 11:42:47 PM | [原创]如何从数据库中直接获取image等二进制文件
今天有老师问我要他的照片,我本地没有装读取照片的程序,本准备临时写个程序来读取,不过后来找到一个很好用的命令,一句话搞定
C:\Program Files\Microsoft SQL Server\MSSQL\Binn>TEXTCOPY /D database /T table /C column /W "where no='1000'" /F 1000.jpg /O /Z
该命令的说明
Program Files\Microsoft SQL Server\MSSQL\Binn目录下。
TEXTCOPY [/S [sqlserver]] [/U [login]] [/P [password]]
[/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 not
specified, the local SQL Server is used.
/U login The login to connect with. If 'login' is not specified,
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 text or
image data. If 'database' is not specified, the default
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 keyword)
that specifies a single row of 'table'.
/F file The file name.
/I Copy text or image value into SQL Server from 'file'.
/O Copy text or image value out of SQL Server into 'file'.
/K chunksize Size of the data transfer buffer in bytes. Minimum
value is 1024 bytes, default value is 4096 bytes.
/Z Display debug information while running.
/? Display this usage information and exit.
该命令在2005下应该也能用,不过要从2000中copy过去,然后调用cmdshell


评论
发布者 XnnYygn
7/16/2008 6:42:01 AM
。。。。不用权限吗??。。。。
发布者 williamswq
7/16/2008 12:34:40 PM
发布者 天凉好个秋
7/16/2008 10:02:51 PM
发布者 XnnYygn
7/17/2008 8:23:15 AM
发布者 williamswq
7/17/2008 11:33:47 AM