Quick Search for:  in language:    
searches,keyword,text,column,displays,google,
   Code/Articles  |  Newest/Best  |  Community  |  Jobs  |  Other  |  Goto  | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
SQL Stats

 Code: 44,501. lines
 Jobs: 119. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for SQL.
Create thousand Data Base users quickly
By N.D.I.Samantha on 1/1


Numbers from String
By Jeff Michelson on 12/30


Number to words in a single query
By Joseph Varghese on 12/24


Click here to see a screenshot of this code!The Best Columns to Index
By Sherenato on 12/23

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

Google Display

Print
Email
 
VB icon
Submitted on: 10/22/2003 11:36:09 AM
By: chandra sekhar  
Level: Advanced
User Rating: Unrated
Compatibility:SQL Server 2000

Users have accessed this code 1038 times.
 
(About the author)
 
     searches a keyword in a text column and displays as a google search format
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

--**************************************
--     
-- Name: Google Display
-- Description:searches a keyword in a t
--     ext column and displays as a google sear
--     ch format
-- By: chandra sekhar
--
-- Inputs:@str -- text
@keyword-- keyword
--
-- Returns:displays the result as a goog
--     le format
--
--This code is copyrighted and has-- limited warranties.Please see http://
--     www.Planet-Source-Code.com/vb/scripts/Sh
--     owCode.asp?txtCodeId=773&lngWId;=5--for details.--**************************************
--     

/******************************************************************************************************
/******************************************************************************************************
** function Name	: fnSrchFormat
** Created BY		: p.c sekhar 		 
** Date			: 09/29/2003
** Input parameters : @str -- text
			 @srch -- keyword
** Output parameters 	: ""
** RETURN value		:0/1 SUCCESS/FAILURE
** Result		:resultset WITH the keyword IN bold
** Purpose		: FOR most OF the asp applications IF you want TO find a specific keyword
			 THEN this function will gives you AS an html output
/*
-- sample execution 
DECLARE @str varchar(5000),@keyWord varchar(200)
SET @str = 'Microsoft SQL Server 2000 extends the performance, reliability, quality, AND ease-of-use of Microsoft SQL Server version 7.0. Microsoft SQL Server 2000 includes several new features that make it an excellent DATABASE platform for large-scale online transactional processing (OLTP), data warehousing, and e-commerce applications.'
SET @keyWord = 'sql'
SELECT dbo.fnSrchFormat (@str ,@keyWord) 
*/
CREATE function fnSrchFormat
(
@str varchar(5000),@srch varchar(200)
)
returns VARCHAR(5000)
as
    BEGIN
    DECLARE @iPos int 
    DECLARE @strRes varchar(8000)
    DECLARE @iStrt int 
    DECLARE @sformatted varchar(1200)
    SET @iStrt= 0
    SET @sformatted = ''
    SET @iPos = patindex(@srch,@str)
    WHILE NOT @iStrt >= len(@str) + 1
    	BEGIN 
    		IF substring(@str,@iStrt,len(@srch)) = @srch 
    SET @sformatted = @sformatted + '....' + replace(substring(@str,@iStrt -5 ,(@iStrt + 5)),@srch,'<B>' + @srch + '</B>')+ '....'
    	SET @iStrt = @iStrt + 1
    	CONTINUE
    	END 
    RETURN @sformatted 
END


Other 2 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments

 There are no comments on this submission.
 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | SQL Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.