Not able to Attach Database in SQL Server due to large file name with spaces in syntax
To reproduce, use the ADS install at 10.168.11.57 and use the database named GTWMDB which I have detached.
1. Open SQL Server DBA Tool - Storage Manager
2. Go to the Databases Tab
3. Right Click on any database and select Attach Database
4. Add a file
5. Save the Alter and ADS fails with an error message saying the file length is too large.
The file that starts with 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\GTWMDB_Data.mdf ' is too long. Maximum length is 259.
Msg: 103, Level: 15, State: 3, Procedure: , Line: 0
Note:
If you closely look at the Syntax, you can find that after the file name, there is lots of free spaces. See screenshot 2
Sample SQL Syntax created by ADS
USE [master]
GO
CREATE DATABASE [GTWMDB] ON
(FILENAME=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\GTWMDB_Data.mdf '),
(FILENAME=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\GTWMDB_Log.mdf '),
(FILENAME=N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\new.mdf ')
FOR ATTACH
GO
if not exists (select name from master.sys.databases sd where name = N'GTWMDB' and
SUSER_SNAME(sd.owner_sid) = SUSER_SNAME() ) EXEC [GTWMDB].dbo.sp_changedbowner
@loginame=N'sa', @map=false
GO
fixed but needs testing
Issue #9567 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build v13.0.3-5 |
No time estimate |
1 issue link |
relates to #9587
Issue #9587Alter to attach a database - attach succeeds, but the Alter dialog does not close - 13.0.3-5 |
fixed but needs testing