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
 General SQL Server Forums
 New to SQL Server Programming
 Get only words from a column not the whole column

Author  Topic 

amodi
Yak Posting Veteran

83 Posts

Posted - 2009-10-05 : 03:37:30
Hello Friends

I have table which contains a column (say Col1) of type varchar(8000).

Col1 basically contains 200-300 words.

Table has many records.

My requirement is I want to retrieve words that start with ‘tur’ in Col1 ( not the whole column data )

I tried the following query:
SELECT Col1
FROM table
WHERE Col1 LIKE 'tur%'

But above query is selecting the whole column data, I don’t want the whole data, I want only words that start with ‘tur’

Note: I am using Full-Text Search on the same column(for search module) I need the above requirement for ajax auto Complete feature, so that when end-user starts entering a search word he/she should get the auto suggest( the words that are available in the database ).

Hope my question is clear.


Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-05 : 03:53:10
Do you have many words in a single column?
Post some sample data with expected result


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

amodi
Yak Posting Veteran

83 Posts

Posted - 2009-10-05 : 04:07:38
quote:
Originally posted by madhivanan

Do you have many words in a single column?
Post some sample data with expected result


Madhivanan

Failing to plan is Planning to fail



Yes there are many words in a column, for example the column data may look like:

Welcome to the Information System

   A comprehensive compilation of knowledge and systems to meet the team member's need for information. This system is an innovation to promote operations excellence with the continuous development of the standards and culture of team members



If input is: "com"

then output should be:
1. comprehensive
2. compilation

if input is 'in"
then output should be:
1. information
2. innovation

if input is "s"
the output shuld be:
1. system
2. standards

Thanks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-05 : 04:15:12
Search for Split function in this forum

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

amodi
Yak Posting Veteran

83 Posts

Posted - 2009-10-28 : 04:25:28
quote:
Originally posted by madhivanan

Search for Split function in this forum

Madhivanan

Failing to plan is Planning to fail



Thanks madhivanan!
Go to Top of Page
   

- Advertisement -