在sql表中插入10个空格 [英] Insert 10 spaces into sql table
本文介绍了在sql表中插入10个空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好b $ b
我想使用sql在表中插入10个空格。我使用了SPACE(10),但它使用下面的代码给出零大小。
Hi
I want to insert 10 spaces into table using sql. I have used SPACE(10), but it is giving zero size, using below code.
DECLARE @Space VARCHAR(10)
SET @Space = SPACE(10);
select len(@space) -- Giving 0, here I required to get 10
非常感谢任何帮助。
Any help is greatly appreciated.
推荐答案
LEN()不会计算尾随空格
LEN() will not calculate trailing space
DECLARE @Space VARCHAR(10)
SET @Space = SPACE(10);
select DATALENGTH(@space)
--or
select len(Replace(@space,' ','*'))
快乐编码!
:)
Happy Coding!
:)
这篇关于在sql表中插入10个空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文