[英]How to delete leading empty space in a SQL Database Table using MS SQL Server Management Studio
I imported an Excel sheet with countries into a database table. 我将带有国家/地区的Excel工作表导入到数据库表中。
Unfortunately all rows have some leading empty space. 不幸的是,所有行都有一些空的空间。
So, how can I delete these empty spaces? 那么,我该如何删除这些空格呢?
This will remove leading and trailing spaces 这将删除前导和尾随空格
Update tablename set fieldName = ltrim(rtrim(fieldName));
some versions of SQL Support 某些版本的SQL支持
Update tablename set fieldName = trim(fieldName);
If you just want to remove leading 如果你只是想删除领先
update tablename set fieldName = LTRIM(fieldName);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.