December 13, 2008 at 3:48 am
how to insert image into a table in sql 2005
December 13, 2008 at 7:05 am
Start by reading:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/b0d8769c-7598-4f97-8162-ace5f182b5bc.htm
and then:
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/996f2f14-51dd-4e92-a422-d5ab417f2d39.htm
Hope this helps. But note that Microsoft has stated that
ntext, text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead. For more information, see Using Large-Value Data Types.
Large-Value data types
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/2e4078e5-92c3-4a2a-b092-c38f501b0d1e.htm
December 13, 2008 at 7:27 am
Assuming your table (TestTable) has two columns
FileName varchar(255)
ExternalFile varbinary
to store the file within the table, you'd write something like this..
Insert into TestTable(FileName , ExternalFile)
Select 'abc', BulkColumn FROM OPENROWSET(
Bulk N'C:\FileLocation\abc.jpg', SINGLE_BLOB)
Refer to http://www.microsoft.com/technet/prodtechnol/sql/2000/reskit/part3/c1161.mspx?mfr=true
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply