Question: i have some files and folder in my git repo. But some of them have a very long path that when i try to synchronize my workspace with git it gives me an error because windows cannot have characters in a path more than 260. Is there a way to pull specific files and folders? for example `*.php` files from `/file/*.php`?

I do not know much from git and also all other tutorials and answers i found here do not work. i even tried the `git git_core.longpathenabled true` but nothing happened.

Any ideas?

Answer: 
Another option, using [`CHARINDEX`](https://msdn.microsoft.com/en-us/library/ms186323(v=sql.90).aspx), [`REPLACE`](https://msdn.microsoft.com/en-us/library/ms186862(v=sql.90).aspx) and [`SUBSTRING`](https://msdn.microsoft.com/en-us/library/ms187748(v=sql.90).aspx):

```
DECLARE @OriginalString varchar(50) = 'a|b^c^d^e|f|g'

DECLARE @MyString varchar(50) = @OriginalString 

WHILE CHARINDEX('^', @MyString) > 0 
BEGIN
    SELECT @MyString = REPLACE(@MyString, 
                               SUBSTRING(@MyString, 
                                         CHARINDEX('^', @MyString), 
                                         CASE WHEN CHARINDEX('|', @MyString, CHARINDEX('^', @MyString)) > 0 THEN
                                            CHARINDEX('|', @MyString, CHARINDEX('^', @MyString)) - CHARINDEX('^', @MyString)
                                         ELSE
                                            LEN(@MyString)
                                         END
                                         )
                       , '')
END

SELECT @OriginalString As Original, @MyString As Final

```

Output:

```
Original              Final
a|b^c^d^e|f|g         a|b|f|g

```
First split the values delimited by `|` then extract the first value and concatenate the result back to get the result 

Try this

```
SELECT Cast(left(intr,len(intr)-1) AS VARCHAR(1000)) AS res
FROM   (SELECT LEFT(split_val, Isnull(NULLIF(Charindex('^', split_val), 0)-1, Len(split_val))) + '|'
        FROM   Udf_splitstring('a|bdd^c|d|e^f|g', '|')
        FOR xml path (''))a (intr) 

```

**Result :** `a|bdd|d|e|g`

Here is a article about split string functions **[Split strings the right way – or the next best way](http://sqlperformance.com/2012/07/t-sql-queries/split-strings)**