Click here to Skip to main content
14,327,370 members
Rate this:
Please Sign up or sign in to vote.
See more:
How to get first 10 characters from a string and last 16 characters of a string and concatenate it with '''?

String: You will Find Unix as well as Business Intelligence

output should be like : You will F'''ess Intelligence

What I have tried:

I tried to use Left and RIght function and then concatenate the two results with ''' but its not working.please suggest.
Posted
Updated 13-May-19 21:56pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

DECLARE @STR NVARCHAR(MAX);
SET @STR = 'You will Find Unix as well as Business Intelligence';
SELECT LEFT(@STR, 10) + '''''''' + RIGHT(@STR, 16)
   
Comments
Member 12965461 14-May-19 4:04am
   
Thanks a lot.it worked
OriginalGriff 14-May-19 4:11am
   
You're welcome!

In future though, try to avoid "its not working" - that doesn't tell us anything about the problem as we know "something isn't working" or you wouldn't have spent the time to post the question! :laugh:
Since we can't see your screen, access your HDD, or read your mind you need to give us actual information, such as sample code, error messages, inputs, outputs, expectations. The better the info you give us, the better a solution we can give you. Help us to help you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100