SQL Server: How to perform Rtrim on all varchar columns of a table

前端 未结 5 1988
眼角桃花
眼角桃花 2020-12-30 01:40

I have over 30 columns in my table (sql server 2008). Columns type are varchar(x). I know that in every column there is two extra spaces at the end of column value. How to u

5条回答
  •  攒了一身酷
    2020-12-30 02:05

    It is perfect... But remember to put also the where clause:

    COLUMNPROPERTY(OBJECT_ID(TABLE_SCHEMA+'.'+TABLE_NAME),COLUMN_NAME,'IsComputed') = 0

    Ohterwise you will get an error if the table has a computed column of "%char%" type!

提交回复
热议问题