I am using T-SQL to backup my MS SQL 2008 databases:
BACKUP DATABASE @name TO DISK = @fileName
The problem occurs when it comes to the databases with their name length greater than 50 characters like this one:
I then get this error:
I know that the maximum length of a database name is 50 characters, but this database has been automatically created by SharePoint, so I assume it is legal in a way.
It's like if it trunks the database name to the first 50 characters, so of course it cant find the database.
Please help me to take these databases in backup, these are critical. Thanks!
I finally found why I got this error, thanks to mfinni.
This the part of my script that caused problem:
DECLARE @name VARCHAR(50)
I simply changed to:
DECLARE @name VARCHAR(200)