嗨我想打印那样的东西
I will start from there
test this phrase
所以我做了以下
declare @x varchar(max)
select @x = LEFT(' '+'I will start from there',LEN('test this phrase')+ LEN('I will start from there'))+ CHAR(10) + 'test this phrase'
print @x
输出
I will start from there
test this phrase
第一行没有从第二行的开头开始,left
应该做的但不确定是什么错误
答案 0 :(得分:2)
尝试使用SPACE功能,如下所示
declare @x varchar(100)
select @x = LEFT(SPACE(LEN('test this phrase')+1)+'I will start from there',LEN('test this phrase')+ LEN('I will start from there'))+ CHAR(10) + 'test this phrase'
print @x