Question: I have the following string:

```
declare @Request varchar(255)
set @Request= '**URGENT** Apple / Iphone/ Test/Future Resolution/Approved'

```

Using an SQL query, how do I return just the word 'Apple'?

I've tried something like this but it does not work:

```
select substring(@Request,CharIndex('** ',@Request),charindex(' / ',@Request))

```

Thank you so much for your input,

Lori

Answer: 
Try this:

```
select SUBSTRING(@request, CHARINDEX('Apple', @Request, 0), LEN('Apple'))

```

If Apple is just an example, and you need a dynamic one, try this:

```
select SUBSTRING(@request, CHARINDEX('** ', @Request, 0)+3, CHARINDEX(' / ', @Request, 0)-CHARINDEX('** ', @Request, 0)-3)

```
Third parameter should be a length of string you are trying to extract. Try with this:

```
select substring(@Request,CharIndex('** ',@Request),charindex(' / ',@Request)-CharIndex('** ',@Request))

```