Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Employee Registration

Author  Topic 

GaneshRamanan
Starting Member

40 Posts

Posted - 2011-06-27 : 05:42:32
Can u pls help me to give an Idea. How to we should store Image file in SQL SERVER and how we should compare in (WHERE CLAUSE).

Thanks,
Ganesh Ramanan

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-27 : 05:51:04
Image of an Employee?
Store it in file system and handle (path)filename in the database.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

jfarrugia
Yak Posting Veteran

55 Posts

Posted - 2011-06-27 : 06:00:44
SQL server 2k5 (+ newer versions) has an image datatype, i THINK, earlier versions use direct binary.

Very simple example below:

http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx

Where software development knowledge meets the reader
Go to Top of Page

GaneshRamanan
Starting Member

40 Posts

Posted - 2011-06-27 : 06:53:57
this is for using thumb impression device program, i m using varbinary(max) datatype. how i should compare? if that image exists or not? i couldnt compare on where clause?

Thanks in Advance,
Ganesh Ramanan
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-06-27 : 07:24:20
If this is for authentication you won't get an exact match.
You should get a product to do it for you as it will need some sort of confidence measure and probably match points.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

GaneshRamanan
Starting Member

40 Posts

Posted - 2011-06-27 : 08:18:52
That Device wont do any match points, its only scan the image and save it to the database, here i m using varbinary(max) datatype, can any one post an idea how to compare those values?

Thanks in Advance,
Ganesh Ramanan
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-06-27 : 08:33:00
You could save it to a file and use windiff.
I would try that first before going any further.
I don't know what the resolution of the reader is but I would doubt if you would ever get an exact match if it's an image.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jfarrugia
Yak Posting Veteran

55 Posts

Posted - 2011-06-27 : 11:21:16
just a shot in the dark...can't you hash the value before searching? something like:

where fn.hash(cast(colImage as varbinary(MAX))) = fn.hash(cast(searchBindary as varbinary(MAX)))

Where software development knowledge meets the reader
Go to Top of Page

jfarrugia
Yak Posting Veteran

55 Posts

Posted - 2011-06-27 : 11:22:27
where fn.hash would be a hash function, you could use an md5 inbuilt hash function

HASHBYTES('MD5', 'adfadfasdfasd')

Where software development knowledge meets the reader
Go to Top of Page

jfarrugia
Yak Posting Veteran

55 Posts

Posted - 2011-06-27 : 11:26:53
i just tried a simple comparison between two varbinary fields.. they seem to compare ok even without applying a hash (so a hash doesnt make a difference)

declare @t as varbinary(max)
declare @s as varbinary(max)

set @t = cast('test1' as varbinary(max))
set @s = cast('test1' as varbinary(max))

select @t as t, @s as s

if (@t = @s)
begin
select 'OK'
end

Where software development knowledge meets the reader
Go to Top of Page
   

- Advertisement -