December 2, 2014 at 8:21 am
Hi All,
Can someone help me with the SQL that will always lift hearing date no matter where it is located in the statement.
For example:
A petition for the winding-up of the above named company was presented on 09.09.2003 by Commissioners of Customs & Excise. The hearing is to take place on 22.10.2003 at R C J - London Companies Court, Strand, London WC2A 2LL.
I need to lift only 22.10.2003 from the above statement.
Thanks
Emma
December 2, 2014 at 8:32 am
Well if you're always going to get the data in that format.
DECLARE @input varchar(500)
SET @input = 'A petition for the winding-up of the above named company was presented on 09.09.2003 by Commissioners of Customs & Excise. The hearing is to take place on 22.10.2003 at R C J - London Companies Court, Strand, London WC2A 2LL.'
SELECT SUBSTRING(@input, CHARINDEX('The hearing is to take place on ', @input) + 32, 10)
December 2, 2014 at 8:43 am
Thanks Old hand
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply