TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
narasiman rao
NA
519
767.4k
calling a sclar function select query
Dec 12 2017 12:35 PM
i have written one function, function name fn_parsehtml.
function fn_parsehtml as follows
CREATE FUNCTION [dbo].[fn_parsehtml]
(
@htmldesc varchar(max)
)
returns varchar(max)
as
begin
declare @first int, @last int,@len int
set @first = CHARINDEX('<',@htmldesc)
set @last = CHARINDEX('>',@htmldesc,CHARINDEX('<',@htmldesc))
set @len = (@last - @first) + 1
while @first > 0 AND @last > 0 AND @len > 0
begin
---Stuff function is used to insert string at given position and delete number of characters specified from original string
set @htmldesc = STUFF(@htmldesc,@first,@len,'')
SET @first = CHARINDEX('<',@htmldesc)
set @last = CHARINDEX('>',@htmldesc,CHARINDEX('<',@htmldesc))
set @len = (@last - @first) + 1
end
return LTRIM(RTRIM(@htmldesc))
end
i have one table as follows
Table name Sample
in table sample record as follows
Courselist
<table backcolor: #fffff3" width="50"> <tr> <td> fees paid by cash> </td> </tr></table>
<table backcolor: #gfr4" width="850"> <tr> <td> no amount dues> </td> </tr></table>
Select dbo.fn_parsehtml('Courselist')
but when i execute above query i get output as follows
Courselist (courselist column name only i am getting).
( the courselist column name only i am getting. i want courselist values as fees paid by cash and no amount dues)
what is the mistake in my above code.
Reply
Answers (
1
)
Incorrect syntax near.. in SQL Server Statement?
How to create web services for the SQL server to do CRUD