Thanks Ray, that worked like a charm!

-----Original Message-----
From: Ray Thompson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 17, 2003 4:05 PM
To: SQL
Subject: RE: selecting first sentence with a query?

In SQL2K you can use the charindex function to find the period and use that
as the length.

SELECT p.id,
       p.pp_name,
       substring(p.question1,1,charindex('.',p.question1)) AS question1,
       c.Zip
FROM personalpagesindex p

Ray Thompson
Systems Administrator
Tau Beta Pi Association www.tbp.org
The Engineering Honor Society
Integrity and Excellence in Engineering

  _____  

From: Reece, Cynthia [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 17, 2003 3:53 PM
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]

Reply via email to