?? 導(dǎo)出northwind中employees的圖像.sql
字號:
--用下面的方法導(dǎo)出就可以保證導(dǎo)出標(biāo)準(zhǔn)的圖片文件
declare @id int,@fn nvarchar(260),@tmpfn nvarchar(260)
select @id=2 --要導(dǎo)出的employeeid
,@fn='c:\test.bmp' --導(dǎo)出生成的文件名
,@tmpfn='c:\tmp.bak' --導(dǎo)出過程中使用的臨時文件名
--生成臨時表,控制取消圖片數(shù)據(jù)中的前綴
create table ##tb(img image)
insert into ##tb
select photo from northwind..Employees where employeeid=@id
--刪除前綴處理
declare @p varbinary(16)
select @p=textptr(img) from ##tb
updatetext ##tb.img @p 0 78 null
--導(dǎo)出數(shù)據(jù)
declare @sql varchar(8000)
set @sql='bcp "select * from(select null as 類型 union all select 0 as 前綴 union all select 0 as 長度 union all select null as 結(jié)束 union all select null as 格式) a" queryout "'
+@tmpfn+'" /c /S"zj" /P""'
exec master..xp_cmdshell @sql,no_output
set @sql='bcp ##tb out "'+@fn+'" /S"zj" /P"" /i"'+@tmpfn+'"'
exec master..xp_cmdshell @sql,no_output
set @sql='del '+@tmpfn
exec master..xp_cmdshell @sql,no_output
go
drop table ##tb
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -