1

Topic: Splitting on a gap

Prompt as to me to implement splitting of 2 words on a gap?

2

Re: Splitting on a gap

Pabl0;
And how you already tried? What string functions in T-SQL studied?

3

Re: Splitting on a gap

Kind  - Eh;

declare @str varchar (max)
set @str ="
select @str = str + ' ' + [CardOwner] from
[Corp. Emg]. [dbo]. [TemporaryWorkerBankInfo]
SET @str ='select ' "+ replace (ltrim (@str), ' ', '" as City union all select ' ") + '"'
exec (@str)

4

Re: Splitting on a gap

Pabl0;
Unless it is splitting? You collect values of attribute CardOwner at line with a separator - a quote.

5

Re: Splitting on a gap

SELECT *, left (CardOwner, charindex (' ', CardOwner)-1), RIGHT (CardOwner, charindex (' ', CardOwner)-1)
FROM TemporaryWorkerBankInfo B
Select substring (CardOwner, 1, charindex (' ', CardOwner)-1) as L, substring (CardOwner, charindex (' ', CardOwner) +1, len (CardOwner) - (charindex (' ', CardOwner) +1)) as F
from TemporaryWorkerBankInfo

6

Re: Splitting on a gap

Only an error produces
Or SUBSTRING the invalid parameter of length is transferred function LEFT.

7

Re: Splitting on a gap

Pabl0 wrote:

Only an error produces
Or SUBSTRING the invalid parameter of length is transferred function LEFT.

charindex (' ', CardOwner)-1

Whether and there is at you a gap in ALL lines, ?

8

Re: Splitting on a gap

Pabl0;
If the gap is not, it falls off.

declare @CardOwner varchar (10) = ' ab ';
Select substring (@CardOwner, 1, charindex (' ' ,@CardOwner)-1) as L, substring (@CardOwner, charindex (' ' ,@CardOwner) +1, 1000) as F

9

Re: Splitting on a gap

Colleagues, what you such difficult today?

SELECT PARSENAME (' PervoeSlovo.  ', 2), PARSENAME (' PervoeSlovo. C ', 1)

10

Re: Splitting on a gap

Cammomile , at it a separator , instead of a point... ?

11

Re: Splitting on a gap

Akina wrote:

What interesting ... smile

12

Re: Splitting on a gap

SELECT *, left (CardOwner, charindex (' ', CardOwner)-1), RIGHT (CardOwner, len (CardOwner) - (charindex (' ', CardOwner)-1)) - here a gap superfluous in the beginning how to remove?
FROM TemporaryWorkerBankInfo B

13

Re: Splitting on a gap

Akina, certainly. And that is not present that?

14

Re: Splitting on a gap

Pabl0;
If the gap is not, it falls off.

declare @CardOwner varchar (10) = ' ab ';
Select substring (@CardOwner, 1, charindex (' ' ,@CardOwner)-1) as L, substring (@CardOwner, charindex (' ' ,@CardOwner) +1, 1000) as F