Insert and Update image field in SQL Server 2008/2005
来源:互联网 发布:吾爱破解 知乎 编辑:程序博客网 时间:2024/04/29 12:04
Ok, now let us move ahead with our script in SQL Server itself.
--create table for demonstration
create table emps
(
name varchar(50),
dept varchar(10),
empImg image
)
GO
--insert statement with single_blob to upload image to SQL Server
INSERT INTO emps([Name],dept,empImg)
SELECT 'Ritesh','MIS',
(select * FROM OPENROWSET(BULK'C:\Ritesh.JPG', SINGLE_BLOB) AS img)
GO
--check the inserted data
select * from emps
GO
--update your table, along with image also.
update emps
set empImg=(select* FROM OPENROWSET(BULK'C:\Ritesh1.JPG', SINGLE_BLOB) AS img), dept='IT'
where name='Ritesh'
GO
--check the data whether it has been updated
select * from emps
go
Happy SQLing!!!
- Insert and Update image field in SQL Server 2008/2005
- Using MERGE in SQL Server to insert, update and delete at the same time
- Insert, Update, Delete in ASP.NET Gridview, DataSource as SQL Server, MS Access (mdb/accdb), XML and
- using pyodbc on ubuntu to insert a image field on SQL Server
- Image store in SQL-Server 2005 database and retrieve it in asp.net application with C#:
- 【SQL Server学习笔记】INSERT、UPDATE 语句
- sql server merge 做insert和update
- Index Fragmentation Report in SQL Server 2005 and 2008
- [学习SQL SERVER 2005系列]关于INSERT、UPDATE 或 DELETE的OUTPUT及OUTPUT...INTO...用法
- hibernate 调用存储过程 sql server 2005 -insert update delete find
- Sql Server Trigger 的使用(Insert ,Update,Delete...)
- Solutions for INSERT OR UPDATE on SQL Server
- SQL Server索引进阶第十三篇:Insert,Update,Delete语句
- SQL Server 根据动态条件insert,update语句
- SQL Server索引进阶第十三篇:Insert,Update,Delete语句
- sql server 带有OUTPUT的INSERT,DELETE,UPDATE
- SQL SERVER insert/delete/update 中的 ouput语句
- SQL SERVER INSERT、UPDATE 、DELETE、SELECT增、改、删、查
- 工作中的三种人
- notepad++正则表达式替换字符串详解
- 添加Excel组件引发的问题
- VIJOS P1264 神秘的咒语
- mini2440 dm9000 网卡驱动详解 (二)
- Insert and Update image field in SQL Server 2008/2005
- BIRT 报表整理
- 字符串的经典hash算法
- mini2440 dm9000 网卡驱动详解 (三)
- URAL 1026 - Questions and Answers(计数排序)
- 预处理命令#pragma
- 2013年HDU多校联合第三场解题报告
- 如何控制WAP网站上输入框的默认键盘类型
- 关于matlab 和opencv的源代码查看方式