Inserting Images : Insert Image « Insert Delete Update « SQL Server / T-SQL






Inserting Images


1>
2> drop table Players
3> GO
1> create table Players (
2>    Player_Id int IDENTITY (1, 1) NOT NULL ,
3>    Photograph image NULL
4> )
5> GO
1>
2> -- Inserting Images
3>
4> INSERT INTO Players (Photograph)VALUES (0xFFFFFFFF)
5> GO

(1 rows affected)
1>
2> DECLARE @Pointer_Value varbinary(16)
3> SELECT @Pointer_Value = TEXTPTR(Photograph)
4> FROM Players
5> WHERE Player_ID = 1
6> WRITETEXT Players.Photograph @Pointer_Value "C:\k.bmp"
7> GO
1>
2> select * from Players
3> GO
Player_Id   Photograph
---------------------------------------------------------------
          1 0x433A5C6B2E626D70



(1 rows affected)
1>
2> drop table Players
3> GO
1>
           
       








Related examples in the same category