December 31, 2008 at 6:28 am
Hi,
I want to insert length of an image which is already inserted into DB and while inserting new image i want to insert length also so can anyone tell me the query for the same. Below is the query juz to insert an image.
UPDATE tblImage
--SET imgData1 = (SELECT BulkColumn FROM
-- OPENROWSET(BULK 'F:\MUKESH PERS\Images\30122007092.jpg', SINGLE_BLOB) AS i)
--WHERE (imgID = 3)
December 31, 2008 at 6:59 am
you can use DATALENGTH to get the size of an existing record, not sure how you would handle a new one. Trigger or Indexed column maybe?
December 31, 2008 at 7:10 am
Get datalength from tbl where productid = 'N340'
M nt gettin the length i thk m wrong in writing query.
December 31, 2008 at 11:51 am
select datalength(imagecolumnnamehere) from tbl where productid = 'N340'
* Noel
December 31, 2008 at 12:18 pm
If you really need a column to show the length, don't store this data and try to keep it updated all the time. Create a computed column or create a view and use the datalength function.
With a computed column, the column will always be calculated and up to date.
The same thing applies to a view.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply