Hello,
Can someone help me with a SQL code sample to insert a Picture / Documentin
image data field?
Regards
SathianSathian,
One or more of the following KB articles, should help you!
258038 (Q258038) HOWTO: Access and Modify SQL Server BLOB Data by Using the
ADO Stream Object
http://support.microsoft.com/?kbid=258038
201785 (Q201785) HOWTO: Import FileSystem Data Using DTS and Index Server
http://support.microsoft.com/defaul...kb;en-us;201785
309158 (Q309158) HOW TO: Read and Write BLOB Data by Using ADO.NET with C#
http://support.microsoft.com/defaul...kb;EN-US;309158
308042 (Q308042) HOW TO: Read and Write BLOB Data by Using ADO.NET with
VB.NET
http://support.microsoft.com/defaul...kb;EN-US;308042
326502 (Q326502) HOW TO: Read and Write BLOB Data by Using ADO.NET Through
ASP.NET
http://support.microsoft.com/?id=326502
Hope that helps!
John
--
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/
"Sathian T" <sathian.t@.in.Bosch.com> wrote in message
news:cta232$23a$1@.ns2.fe.internet.bosch.com...
> Hello,
> Can someone help me with a SQL code sample to insert a Picture /
Documentin
> image data field?
> Regards
> Sathian
>|||Hi
The following article and links to KB articles should give you everything
you need!
http://www.aspfaq.com/show.asp?id=2149
John
"Sathian T" wrote:
> Hello,
> Can someone help me with a SQL code sample to insert a Picture / Documenti
n
> image data field?
> Regards
> Sathian
>
>|||or this ;0)
-- OJ: TEXTCOPY example
-- Loading files into db &
-- exporting files out to folder
--
--TEXTCOPY IN
--
--create tb to hold data
create table tmp(fname varchar(100),img image default '0x0')
go
declare @.sql varchar(255),
@.fname varchar(100),
@.path varchar(50),
@.user sysname,
@.pass sysname
set @.user='myuser'
set @.pass='mypass'
--specify desired folder
set @.path='c:\winnt'
set @.sql='dir ' + @.path + '*.bmp /c /b'
--insert filenames into tb
insert tmp(fname)
exec master..xp_cmdshell @.sql
--loop through and insert file contents into tb
declare cc cursor
for select fname from tmp
open cc
fetch next from cc into @.fname
while @.@.fetch_status=0
begin
set @.sql='textcopy /s"'+@.@.servername+'" /u"'+@.user+'" /p"'+@.pass+'"
/d"'+db_name()+'" /t"tmp" /c"img" /w"where fname=''' + @.fname + '''"'
set @.sql=@.sql + ' /f"' + @.path + @.fname + '" /i' + ' /z'
print @.sql
exec master..xp_cmdshell @.sql ,no_output
fetch next from cc into @.fname
end
close cc
deallocate cc
go
select * from tmp
go
--
--TEXTCOPY OUT
--
declare @.sql varchar(255),
@.fname varchar(100),
@.path varchar(50),
@.user sysname,
@.pass sysname
set @.user='myuser'
set @.pass='mypass,'
--specify desired output folder
set @.path='c:\tmp'
set @.sql='md ' + @.path
--create output folder
exec master..xp_cmdshell @.sql
--loop through and insert file contents into tb
declare cc cursor
for select fname from tmp
open cc
fetch next from cc into @.fname
while @.@.fetch_status=0
begin
set @.sql='textcopy /s"'+@.@.servername+'" /u"'+@.user+'" /p"'+@.pass+'"
/d"'+db_name()+'" /t"tmp" /c"img" /w"where fname=''' + @.fname + '''"'
set @.sql=@.sql + ' /f"' + @.path + @.fname + '" /o' + ' /z'
print @.sql
exec master..xp_cmdshell @.sql ,no_output
fetch next from cc into @.fname
end
close cc
deallocate cc
set @.sql='dir ' + @.path + '*.bmp /c /b'
exec master..xp_cmdshell @.sql
go
drop table tmp
go
-oj
"Sathian T" <sathian.t@.in.Bosch.com> wrote in message
news:cta232$23a$1@.ns2.fe.internet.bosch.com...
> Hello,
> Can someone help me with a SQL code sample to insert a Picture /
> Documentin
> image data field?
> Regards
> Sathian
>|||John,
The MAJOR thing wrong with the below link is that it makes NO reference to
the advantages of storing documents (MS Word, Excel, Adobe's PDF, etc.) and
only references the storing of images, such as *.jpg files (which can also
be FT Indexed with existing JPEG IFilters). While, I don't want to start a
flame war, and I've not reviewed all of the KB articles (I will at a later
time, as I have to go to work ;-), I strongly disagree with the premise of
this links recommendation as it makes NO reference to advantage of storing
files for the purpose of accessing the content of these files via Full text
Search that is fully support by Microsoft in SQL Server 7.0, SQL Server 2000
and vastly improved in SQL Server 2005.
Respectively,
John
--
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
news:EFED2C44-641B-4AD8-87D2-4DFB9E45214C@.microsoft.com...
> Hi
> The following article and links to KB articles should give you everything
> you need!
> http://www.aspfaq.com/show.asp?id=2149
> John
>
> "Sathian T" wrote:
>
Documentin
No comments:
Post a Comment