Skip to main content
Incorporated comment
Source Link
Paul White
  • 90.3k
  • 30
  • 424
  • 663

You can try something like this Pix, see if it works for you.
Just change the declared variable to a column in a table and remove the set statement. At least it will give you a template to go off of.

declare @notes varchar(2000);

set @notes = 'Up unpacked friendly ecstatic so possible humoured do. Ample ended might folly quiet one set spoke her. We no am former valley assure. Four need spot ye said we find mile. Are commanded him convinced dashwoods did estimable forfeited. Shy celebrated met sentiments she reasonably but. Proposal its disposed eat advanced marriage sociable. Drawings led greatest add subjects endeavor gay remember. Principles one yet assistance you met impossible. The who arrival end how fertile enabled. Brother she add yet see minuter natural smiling article painted. Themselves at dispatched interested insensible am be prosperous reasonably it. In either so spring wished. Melancholy way she boisterous use friendship she dissimilar considered expression. Sex quick arose mrs lived. Mr things do plenty others an vanity myself waited to. Always parish tastes at as mr father dining at. Led ask possible mistress relation elegance eat likewise debating. By message or am nothing amongst chiefly address. The its enable direct men depend highly. Ham windows sixteen who inquiry fortune demands. Is be upon sang fond must shew. Really boy law county she unable her sister. Feet you off its like like six. Among sex are leave law built now. In built table in an rapid blush. Merits behind on afraid or warmly.'

select start_off = @notes;

-- select length_1000 = substring(@notes, 0, 1000); -- the full 1000

-- select last_full_stop = charindex('.', reverse(left(@notes, 1000))); -- use 1000 - this number to get the last full stop

-- select right(left(@notes, 1000), 1); -- the character at the 1000 position

select  potential_answer = 
        case when right(left(@notes@Test, 1000), 1) = '.' then substringLeft(@notes, 0@Test, 1000)
        else substring(@notes@Test, 1, 1000 - charindex('.', reverse(left(@notes@Test, 1000))) + 1) -- add 1 to add in the full stop
        end

Probably not the best, but it works with your example.

You can try something like this Pix, see if it works for you.
Just change the declared variable to a column in a table and remove the set statement. At least it will give you a template to go off of.

declare @notes varchar(2000);

set @notes = 'Up unpacked friendly ecstatic so possible humoured do. Ample ended might folly quiet one set spoke her. We no am former valley assure. Four need spot ye said we find mile. Are commanded him convinced dashwoods did estimable forfeited. Shy celebrated met sentiments she reasonably but. Proposal its disposed eat advanced marriage sociable. Drawings led greatest add subjects endeavor gay remember. Principles one yet assistance you met impossible. The who arrival end how fertile enabled. Brother she add yet see minuter natural smiling article painted. Themselves at dispatched interested insensible am be prosperous reasonably it. In either so spring wished. Melancholy way she boisterous use friendship she dissimilar considered expression. Sex quick arose mrs lived. Mr things do plenty others an vanity myself waited to. Always parish tastes at as mr father dining at. Led ask possible mistress relation elegance eat likewise debating. By message or am nothing amongst chiefly address. The its enable direct men depend highly. Ham windows sixteen who inquiry fortune demands. Is be upon sang fond must shew. Really boy law county she unable her sister. Feet you off its like like six. Among sex are leave law built now. In built table in an rapid blush. Merits behind on afraid or warmly.'

select start_off = @notes;

-- select length_1000 = substring(@notes, 0, 1000); -- the full 1000

-- select last_full_stop = charindex('.', reverse(left(@notes, 1000))); -- use 1000 - this number to get the last full stop

-- select right(left(@notes, 1000), 1); -- the character at the 1000 position

select potential_answer = 
        case when right(left(@notes, 1000), 1) = '.' then substring(@notes, 0, 1000)
        else substring(@notes, 1, 1000 - charindex('.', reverse(left(@notes, 1000))) + 1) -- add 1 to add in the full stop
        end

Probably not the best, but it works with your example.

You can try something like this Pix, see if it works for you.
Just change the declared variable to a column in a table and remove the set statement. At least it will give you a template to go off of.

declare @notes varchar(2000);

set @notes = 'Up unpacked friendly ecstatic so possible humoured do. Ample ended might folly quiet one set spoke her. We no am former valley assure. Four need spot ye said we find mile. Are commanded him convinced dashwoods did estimable forfeited. Shy celebrated met sentiments she reasonably but. Proposal its disposed eat advanced marriage sociable. Drawings led greatest add subjects endeavor gay remember. Principles one yet assistance you met impossible. The who arrival end how fertile enabled. Brother she add yet see minuter natural smiling article painted. Themselves at dispatched interested insensible am be prosperous reasonably it. In either so spring wished. Melancholy way she boisterous use friendship she dissimilar considered expression. Sex quick arose mrs lived. Mr things do plenty others an vanity myself waited to. Always parish tastes at as mr father dining at. Led ask possible mistress relation elegance eat likewise debating. By message or am nothing amongst chiefly address. The its enable direct men depend highly. Ham windows sixteen who inquiry fortune demands. Is be upon sang fond must shew. Really boy law county she unable her sister. Feet you off its like like six. Among sex are leave law built now. In built table in an rapid blush. Merits behind on afraid or warmly.'

select start_off = @notes;

-- select length_1000 = substring(@notes, 0, 1000); -- the full 1000

-- select last_full_stop = charindex('.', reverse(left(@notes, 1000))); -- use 1000 - this number to get the last full stop

-- select right(left(@notes, 1000), 1); -- the character at the 1000 position

select  potential_answer = 
        case when right(left(@Test, 1000), 1) = '.' then Left(@Test,1000)
        else substring(@Test, 1, 1000 - charindex('.', reverse(left(@Test, 1000))) + 1) -- add 1 to add in the full stop
        end

Probably not the best, but it works with your example.

Source Link
Shaneis
  • 1.8k
  • 2
  • 15
  • 20

You can try something like this Pix, see if it works for you.
Just change the declared variable to a column in a table and remove the set statement. At least it will give you a template to go off of.

declare @notes varchar(2000);

set @notes = 'Up unpacked friendly ecstatic so possible humoured do. Ample ended might folly quiet one set spoke her. We no am former valley assure. Four need spot ye said we find mile. Are commanded him convinced dashwoods did estimable forfeited. Shy celebrated met sentiments she reasonably but. Proposal its disposed eat advanced marriage sociable. Drawings led greatest add subjects endeavor gay remember. Principles one yet assistance you met impossible. The who arrival end how fertile enabled. Brother she add yet see minuter natural smiling article painted. Themselves at dispatched interested insensible am be prosperous reasonably it. In either so spring wished. Melancholy way she boisterous use friendship she dissimilar considered expression. Sex quick arose mrs lived. Mr things do plenty others an vanity myself waited to. Always parish tastes at as mr father dining at. Led ask possible mistress relation elegance eat likewise debating. By message or am nothing amongst chiefly address. The its enable direct men depend highly. Ham windows sixteen who inquiry fortune demands. Is be upon sang fond must shew. Really boy law county she unable her sister. Feet you off its like like six. Among sex are leave law built now. In built table in an rapid blush. Merits behind on afraid or warmly.'

select start_off = @notes;

-- select length_1000 = substring(@notes, 0, 1000); -- the full 1000

-- select last_full_stop = charindex('.', reverse(left(@notes, 1000))); -- use 1000 - this number to get the last full stop

-- select right(left(@notes, 1000), 1); -- the character at the 1000 position

select potential_answer = 
        case when right(left(@notes, 1000), 1) = '.' then substring(@notes, 0, 1000)
        else substring(@notes, 1, 1000 - charindex('.', reverse(left(@notes, 1000))) + 1) -- add 1 to add in the full stop
        end

Probably not the best, but it works with your example.