使用SQL语句直接保存图片

来源:互联网 发布:编程珠玑 kindle 编辑:程序博客网 时间:2024/05/18 15:23
[sql] view plaincopyprint?
  1. use Test 
  2. go 
  3. If object_id('Picture') Is Not Null 
  4.     Drop Table Picture 
  5. Go 
  6. Create Table Picture 
  7.     FileName nvarchar(255), 
  8.     ExternalFile varbinary(max
  9. Go 
  10.  
  11. Insert into Picture(FileName , ExternalFile) 
  12. Select 'PitureName', BulkColumnFROM OPENROWSET( 
  13. Bulk N'G:\test.jpg', SINGLE_BLOB)As
  14. Go 
0 0
原创粉丝点击