国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 數(shù)據(jù)庫(kù) > SQL Server > 正文

MS SQL SERVER 圖像或大文本的輸入輸出

2024-08-31 00:49:25
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

在ms sql server 安裝目錄下有個(gè)可執(zhí)行文件叫 textcopy.exe
可對(duì) ms sql server 中的文本或圖像數(shù)據(jù)進(jìn)行輸入輸出.
不過(guò)你可以在ms-dos方式下執(zhí)行textcopy /? 得到它的描述。
下面是這個(gè)工具的描述:
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.

為此, 可寫一個(gè)存儲(chǔ)過(guò)程,調(diào)用這個(gè)命令
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

下面是一個(gè)拷貝圖像到sql server的pubs數(shù)據(jù)庫(kù)的例子, 表名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'

注冊(cè)會(huì)員,創(chuàng)建你的web開發(fā)資料庫(kù),
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 榆树市| 乳山市| 黎城县| 烟台市| 南城县| 河间市| 潼关县| 同心县| 巴塘县| 临沂市| 万宁市| 保定市| 加查县| 巢湖市| 弥渡县| 长岛县| 明光市| 义马市| 区。| 施甸县| 西丰县| 东辽县| 嘉黎县| 万宁市| 大洼县| 资阳市| 永城市| 新宾| 东兰县| 抚顺县| 汤原县| 新竹县| 辰溪县| 璧山县| 黄龙县| 栾城县| 丹东市| 禄丰县| 三门县| 高陵县| 建德市|