选择显示字体大小

ms sql server 图像或大文本的输入输出

ms sql server 安装目录下有个可执行文件叫 textcopy.exe
可对 ms sql server 中的文本或图像数据进行输入输出.
不过你可以在ms-dos方式下执行textcopy /? 得到它的描述。
下面是这个工具的描述:
copies a single text or image value into or out of sql server. the val
ue
is a specified text or image 'column' of a single row (specified by th
e
"where clause") of the specified 'table'. 

if the direction is in (/i) then the data from the specified 'file' is

copied into sql server, replacing the existing text or image value. if
the
direction is out (/o) then the text or image value is copied from
sql server into the specified 'file', replacing any existing file.

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 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.

为此, 可写一个存储过程,调用这个命令
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

下面是一个拷贝图像到sql server的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 = " where pub_id='0736' ",
            @direction = 'i'


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons