如何在 SQL Server 中选择前 100 个字符? [英] How can I select the first 100 characters in SQL Server?
本文介绍了如何在 SQL Server 中选择前 100 个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将一列截断为最多 100 个字符.你如何在 SQL Server 中做到这一点?
I want to truncate a column to a max of 100 characters. How do you do this in SQL Server?
推荐答案
试试这个:
SELECT LEFT (your_column, 100) FROM your_table
你也可以试试这样的:
SELECT LEFT (your_column, LEN(your_column)-5) FROM your_table
例如,如果您想修剪记录中的最后 5 个字符.
for say if you want to trim the last 5 characters from a record.
这篇关于如何在 SQL Server 中选择前 100 个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文