SQL

  • 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

  • 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)

  • 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