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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SP_oacreate

Author  Topic 

Ravi Shankar
Starting Member

3 Posts

Posted - 2008-03-31 : 09:08:20
pls send me some code samples to import a html/txt file using the sp_oacreate procedure
am getting the error number -2147221005


please let me know

nr
SQLTeam MVY

12543 Posts

Posted - 2008-03-31 : 09:11:51
Can you post the code you have at the moment.
sp_oacreate just instantiates a com object so which one are you trying to use.

Have you thought about using bulk insert?

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

Ravi Shankar
Starting Member

3 Posts

Posted - 2008-03-31 : 09:25:46
hi, thanks for the speedy reply,
infact i have a html file which i need to insert into a table with html tags
i was surfing for sp_oacreate
so suggest me a approriate way
i need to do this activity from SQL Server end

Regards
Ravi
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-03-31 : 09:35:29
You mean you have an text file on your disk which you want to import into a column?

try something like
create table #a(s varchar(max))
bulk insert #a from 'c:\myfile.html' with (fieldterminator='%^*O&^£$',columnterminator='!"£"%^^')

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

Ravi Shankar
Starting Member

3 Posts

Posted - 2008-04-01 : 01:50:13
Hi,
Infact the html file with the entire source has to be inserted into a single column.
there is no delimitors, as i said the entire source

pls let me know

and also any help on sp_oacreate way of using file system object

regards
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-04-01 : 05:43:04
Did you look at my previous pot? That should do it.

See
http://www.nigelrivett.net/SQLTsql/CheckIfFileExists.html
for an example of using file system object.

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

- Advertisement -