How to remove trailing spaces from SQL Server logical filename?

Posted by Luke Girvin on Server Fault See other posts from Server Fault or by Luke Girvin
Published on 2009-11-25T10:15:11Z Indexed on 2010/03/09 11:08 UTC
Read the original article Hit count: 350

Filed under:
|

I'm dealing with a server running SQL Server 2000 SP1, and the logical filenames for one of the databases appear to contain trailing spaces. That is, this query:

select replace(name, ' ', 'X') from sysfiles

Returns the expected names plus a long string of Xs.

How can I deal with this? I've tried running ALTER DATABASE... MODIFY FILE using the name (with and without spaces) and get an error message telling me the file does not exist.

© Server Fault or respective owner

Related posts about sql-server

Related posts about filename