declare @S varchar(8000)
set @S = 'This is a test of the Emergency Broadcast System. The
Broadcasters in your area, in voluntary cooperation with the FCC and
other local authorities, have developed this system to keep you informed
in the event of an emergency.'
print left(@S,charindex('.',@S))
You'll run into trouble if they end sentences with ! ? or don't use
punctuation at all. So watch out for that stuff.
-----Original Message-----
From: Reece, Cynthia [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 17, 2003 14:53
To: SQL
Subject: selecting first sentence with a query?
Hi Everyone,
I wondered if this was possible.
I have a query that is selecting a couple of fields, one of which is a
varchar field used to collect the answer to a question. I am currently
selecting the first 100 characters in that field to get a 'snippet' of
the question, but I was asked instead to just select the first sentence.
Is there a way to select up until the first period is encountered?
Thanks!
Cynthia
This is my current query......
SELECT p.id, p.pp_name, substring(p.question1, 1, 100) AS question1,
c.Zip
FROM personalpagesindex p
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
