Calling SQL Gurus - Using delimiters in SQL

Soldato
Joined
11 Feb 2004
Posts
4,532
Location
Surrey, UK
I need to extract a text string from a text field in SQL 2005. Its highlighted in yellow below.

The string looks like this in the db:

<! 2007-10-10 08:09:29 jrt1130 >

I've written a view to do this:

SELECT SUBSTRING(mrDESCRIPTION, 24, 7) AS UserName, mrID, mrGENERATION, mrDESCRIPTION
FROM dbo.MASTER6_DESCRIPTIONS


The problem is - the id can be variable in length. Therefore the start position will always be 24 but I need to use the space right after the id as the delimiter.

Can I achieve this?
 
Yeah its MS SQL 2005 so no regular expressions unfortunately. Sic - LOCATE is not a recognised function? I'm hoping there's an SQL alternative?

EDIT - Just seen your reply!
 
Back
Top Bottom