May 24, 2008 at 10:34 am
Hi All,
I want to insert multiple html files data (contents) to my existing table. I already have table with several columns now I want to insert the data from almost 8000 html files to new column in my table. I try to insert the data by using OPENROWSET() but it only works for me for single file. I want to use it with multiple files input. Like SSIS.
As I am using SQL SERVER EXPRESS 2005 so I cannot use SSIS. I need to use OpenRowSet().
If there is a way then please also let me know that how I can strip the html tags and save only the text from those files by using Pinal Dave store procedure or any other sp.
So basically I want to save 8000 files in my table after striping the tags.
Here is the stored procedure:
CREATE FUNCTION [dbo].[udf_StripHTML] (@HTMLText VARCHAR(MAX)) RETURNS VARCHAR(MAX) AS BEGIN DECLARE @Start INT DECLARE @End INT DECLARE @Length INT SET @Start = CHARINDEX(‘ ’,@HTMLText,CHARINDEX(‘<’,@HTMLText)) SET @Length = (@End - @Start) + 1 END RETURN LTRIM(RTRIM(@HTMLText)) END GO
May 30, 2008 at 3:09 am
Using T-SQL you'd have to loop through all the files and import one at at time.
IMHO, you'd be much better off designing a client application instead. This way you can also process more files simultaneously.
ML
---
Matija Lah, SQL Server MVP
http://milambda.blogspot.com
August 10, 2017 at 12:39 pm
nuhassan786 - Saturday, May 24, 2008 10:34 AMHi All,I want to insert multiple html files data (contents) to my existing table. I already have table with several columns now I want to insert the data from almost 8000 html files to new column in my table. I try to insert the data by using OPENROWSET() but it only works for me for single file. I want to use it with multiple files input. Like SSIS.As I am using SQL SERVER EXPRESS 2005 so I cannot use SSIS. I need to use OpenRowSet().If there is a way then please also let me know that how I can strip the html tags and save only the text from those files by using Pinal Dave store procedure or any other sp.So basically I want to save 8000 files in my table after striping the tags.Here is the stored procedure:CREATE FUNCTION [dbo].[udf_StripHTML] (@HTMLText VARCHAR(MAX)) RETURNS VARCHAR(MAX) AS BEGIN DECLARE @Start INT DECLARE @End INT DECLARE @Length INT SET @Start = CHARINDEX(‘ ’,@HTMLText,CHARINDEX(‘<’,@HTMLText)) SET @Length = (@End - @Start) + 1 END RETURN LTRIM(RTRIM(@HTMLText)) END GO
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply