Hello, I have the following data:
I need to find any entry longer than 10 characters in field1. I need to leave the first 10 characters in field1 and move the remaining characters into field 2. This is simple enough, but what I'm hoping to figure out is to move entire words over (not cutting a word in the middle). So, like this:
I'm not sure how to find the nearest space to 10 characters and then move the the data from there. Can anyone help?
Thanks!
Brian
Code:
create table #temp (field1 varchar(100), field2 (varchar (100))
insert into #temp values ('THIS IS A TEST', NULL)
insert into #temp values ('HAPPY ACRES', NULL)
insert into #temp values ('VANILLA', NULL)
I need to find any entry longer than 10 characters in field1. I need to leave the first 10 characters in field1 and move the remaining characters into field 2. This is simple enough, but what I'm hoping to figure out is to move entire words over (not cutting a word in the middle). So, like this:
Code:
Field1 Field2
THIS IS A TEST
HAPPY ACRES
VANILLA
Thanks!
Brian