如何从字符串中获取前10个字符并将字符串的最后16个字符连接起来并将其与'''连接? [英] How to get first 10 characters from a string and last 16 characters of a string and concatenate it with '''?

查看:112
本文介绍了如何从字符串中获取前10个字符并将字符串的最后16个字符连接起来并将其与'''连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从字符串中获取前10个字符并将字符串的最后16个字符连接起来并将其与'''连接?



字符串:您将查找Unix作为以及商业智能



输出应该如下:你将F'''ess Intelligence



< b>我尝试了什么:



我试图使用Left和RIght函数,然后用'''连接两个结果,但它不起作用。请建议。

解决方案

  DECLARE   @ STR   NVARCHAR (MAX); 
SET @ STR = ' 您将找到Unix以及商业智能';
SELECT LEFT @ STR 10 )+ ' '''''' ' + RIGHT @ STR 16


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.

解决方案

DECLARE @STR NVARCHAR(MAX);
SET @STR = 'You will Find Unix as well as Business Intelligence';
SELECT LEFT(@STR, 10) + '''''''' + RIGHT(@STR, 16)


这篇关于如何从字符串中获取前10个字符并将字符串的最后16个字符连接起来并将其与'''连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆