Extract words from sentence(s) using TSQL(SQL SERVER 2005) [ SET BASED SOLUTION]
- by Newbie
I have the following input.
INPUT:
TableA
ID Sentences
--- ----------
1 I am a student
2 Have a nice time guys!
What I need to do is to extract the words from the sentence(s)
and insert each individual word in another table
OUTPUT:
SentenceID WordOccurance Word
---------- ------------ -----
1 1 I
1 2 am
1 3 a
1 4 student
2 1 Have
2 2 a
2 3 nice
2 4 time
2 5 guys!
I am using SQL SERVER 2005.
I am looking for a set based solution.
Thanks