當前位置:首頁 » 編程語言 » sqltextcopy
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

sqltextcopy

發布時間: 2022-11-13 19:14:38

sql2000安裝顯示x的text.exe只讀

前面介紹的只是一個標記Annotation,程序通過判斷Annotation是否存在來決定是否運行指定方法,現在我們要針對只在拋出特殊異常時才成功添加支持,這樣就用到了具有成員變數的註解了。

㈡ 請問如何在sql2000中將圖片存入表

方法:
1、建立過程
CREATE PROCEDURE sp_text (
@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 =
'text /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)
go
insert 表名 values(1,0x) -- 必須的,且不是null
insert 表名 values(2,0x) -- 必須的,且不是null
go

3、讀入
sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\圖片.bmp','where 編號=1','I' --注意條件是 編號=1

sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\bb.doc','where 編號=2','I' --注意條件是 編號=2

go

4、讀出成文件
sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\圖片.bmp','where 編號=1','O' --注意條件是 編號=1

sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\bb.doc','where 編號=2','O' --注意條件是 編號=2
go

************如果報text不是可執行文件的話,你就到
C:\Program Files\Microsoft SQL Server\MSSQL\Binn
目錄下拷備 text.exe到:
C:\Program Files\Microsoft SQL Server\80\Tools\Binn

㈢ SQL2005版本中,是不是沒有text.exe

沒有的。

可以到sql2000下找到text.exe 和 ntwdblib.dll,復制到 ../Microsoft SQL Server/80/Tools/Binn 下面。再設置下環境變數就行。
regsvr32 ntwdblib.dll時如果提示找不到輸入點,可以不管。

參考自:
http://blog.csdn.net/hello520/article/details/1004158

㈣ 如何從SQL中導出照片

在MS SQL SERVER 安裝目錄下有個可執行文件叫 TEXTCOPY.EXE
可對 MS SQL SERVER 中的文本或圖像數據進行輸入輸出.
不過你可以在MS-DOS方式下執行text /? 得到它的描述。
下面是這個工具的描述:
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_text (
@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 =
'text /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_text @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'
你看看 調用成拷貝就行

㈤ 關於SQL中插入WORD文檔的問題

用image類型

方法:
1、建立過程
CREATE PROCEDURE sp_text (
@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 =
'text /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)
go
insert 表名 values(1,0x)
insert 表名 values(2,0x)
go

3、讀入
sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\圖片.bmp','where 編號=1','I' --注意條件是 編號=1

sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\bb.doc','where 編號=2','I' --注意條件是 編號=2

go

4、讀出成文件
sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\圖片.bmp','where 編號=1','O' --注意條件是 編號=1

sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\bb.doc','where 編號=2','O' --注意條件是 編號=2
go

----------------
如報下錯誤:
'text' 不是內部或外部命令,也不是可運行的程序或批處理文件。
如果報'text' 不是內部或外部命令,也不是可運行的程序或批處理文件
的話,你就到
C:\Program Files\Microsoft SQL Server\MSSQL\Binn
目錄下拷備 text.exe到:
C:\Program Files\Microsoft SQL Server\80\Tools\Binn

我的在SQl2000下實驗成功。

㈥ Sql Server中怎麼用text批量上傳圖片

你是用SqlServer什麼版本,2000?2005?2005中已經沒有這個程序了。但可直接對blob 數據類型進行操作:CREATE TABLE #BlobData(BlobData varbinary(max))

--insert blob into temp table
SET @SqlStatement =
N'
INSERT INTO #BlobData
SELECT BlobData.*
FROM OPENROWSET
(BULK ''' + @FileName + ''',
SINGLE_BLOB) BlobData'
EXEC sp_executesql @SqlStatement

--update
UPDATE dbo.MyTable
SET MyBlob = (SELECT BlobData FROM #BlobData)
WHERE MyTable.MyPK = @MyPK

DROP TABLE #BlobData
GO 如果你還是用2000,也就是text方式,參考一下代碼: 1 C:\Program Files\Microsoft SQL Server\MSSQL\Binn>text
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: Proct
8 Type the table: Image
9 Type the text or image column: data
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 Data copied into SQL Server image column from file 'c:\abc.gif'.

㈦ 怎麼在sql資料庫中存放圖片

VB在SQL Server 2000中存儲圖片,其實不是特別困難的。
1、數據表必須有數據類型是Image類型的欄位,這個欄位是可以存儲圖形的二進制數據的,存儲量可達2G位元組。
2、可想,存儲圖形二進制數據,必須就原來的圖形轉換為二進制數據,這是存儲圖形數據的關鍵。
3、存儲的二進制圖形,如果要讀取,必須就二進制數據轉換為圖形數據。

上面是VB在SQL Server 2000中存儲圖片的必須要求。但是也可以在數據表存儲圖形的路徑,這樣比較簡單,但是不安全,我們就以存儲二進制數據討論吧。

一、存儲圖形的關鍵語句:
Dim mst As New ADODB.Stream 'Stream 對象是進行二進制數據操作對象
mst.Type = abTypeBinary
mst.Open
If 圖片的路徑和文件名變數(需要用其他方法獲得)> "" Then
mst.LoadFromFile 圖片的路徑和文件名變數
End If
rs("存儲二進制數據的欄位") = mst.Read

二、讀取存儲的二進制數據的關鍵語句:
Dim mst As New ADODB.Stream
mst.Type = abTypeBinary
mst.Open
mst.Write rs("存儲二進制數據的欄位")
mst.SaveToFile App.Path & "/" & list1.Text,abSaveCreateOverWrite
Picture1.Picture = LoadPicture(App.Path & "/" & List1.Text)
mst.Close '別忘了關閉對象!

㈧ 在sql server中,儲存圖片的數據類型是什麼呀

用image類型

方法:
1、建立過程
CREATE PROCEDURE sp_text (
@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 =
'text /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)
go
insert 表名 values(1,0x)
insert 表名 values(2,0x)
go

3、讀入
sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\圖片.bmp','where 編號=1','I' --注意條件是 編號=1

sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\bb.doc','where 編號=2','I' --注意條件是 編號=2

go

4、讀出成文件
sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\圖片.bmp','where 編號=1','O' --注意條件是 編號=1

sp_text '你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:\bb.doc','where 編號=2','O' --注意條件是 編號=2
go

㈨ 用text將文件夾的圖片導入sql server 2008能一次導入上萬張嗎

不是代碼問題。是方法的問題:
1,網上下載批量修改文件名的軟體可以讓你的文件名序列化。
2,將你需要導入的文件全部管理起來別亂放。直接放到指定目錄
3,命名軟體將所有文件重新序列化

4,代碼導入(你已經寫了)

㈩ 在sql server中建好表後如何存儲圖片文件

方法:
1、建立過程
CREATEPROCEDUREsp_text(
@srvnamevarchar(30),
@loginvarchar(30),
@passwordvarchar(30),
@dbnamevarchar(30),
@tbnamevarchar(30),
@colnamevarchar(30),
@filenamevarchar(30),
@whereclausevarchar(40),
@directionchar(1))
AS
DECLARE@exec_strvarchar(255)
SELECT@exec_str=
'text/S'+@srvname+
'/U'+@login+
'/P'+@password+
'/D'+@dbname+
'/T'+@tbname+
'/C'+@colname+
'/W"'+@whereclause+
'"/F'+@filename+
'/'+@direction
EXECmaster..xp_cmdshell@exec_str

2、建表和初始化數據
createtable表名(編號int,image列名image)
go
insert表名values(1,0x)--必須的,且不是null
insert表名values(2,0x)--必須的,且不是null
go

3、讀入
sp_text'你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:圖片.bmp','where編號=1','I'--注意條件是編號=1

sp_text'你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:b.doc','where編號=2','I'--注意條件是編號=2

go

4、讀出成文件
sp_text'你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:圖片.bmp','where編號=1','O'--注意條件是編號=1

sp_text'你的伺服器名','sa','你的密碼','庫名','表名','image列名','c:b.doc','where編號=2','O'--注意條件是編號=2
go

************如果報text不是可執行文件的話,你就到
C:
目錄下拷備text.exe到:
C: