Ran into the scenario where the user name has an apostrophe. When backing-up this error shows:
The username is something like
The Guys's Place. The ’ is unescaped and causes an error on backup (verified manually in SSMS).
No backup is possible.
'' a backup is possible
This does NOT work:
BACKUP DATABASE TheGuysPlace TO DISK = 'C:\Users\The Guys's Place\Documents\SambaPOS5\Database Backups' WITH FORMAT, NAME = 'test'
This DOES work:
BACKUP DATABASE TheGuysPlace TO DISK = 'C:\Users\The Guys''s Place\Documents\SambaPOS5\Database Backups' WITH FORMAT, NAME = 'test'
String.Replace("'", "''") on the path will fix this for others.
Just a side no note that it’s best not to store database backups in the user folder, should use store elsewhere as SQL by default will not have access to user folders.
It wont but the default location is the user folder and it will ask for permission to that folder on first install you can grant it by choosing yes from the popup in sambapos.
Really? I’ve never seen that before
It does indeed ask that question. But as you said I save it in C drive folder instead.
At what point does it ask? I’ve fresh installed v5.3.0 a few times and not seen that. But also one of the first things I do is set it to another folder. I assume it doesn’t ask in the installer, so when exactly does it popup? Is it if you attempt a backup?
it’s when the first backup is attempted at the default folder location on a fresh install
Yes it asks only for default location. You can make it blank in settings and it will reset to default location and the first attempt at a backup will trigger the prompt to give permission.
I will try that to see it then, thanks.
When I do any setup, first thing I do is change the backup folder, hence why I never saw this. I guess it was added recently?
No it’s been there for a bit. I don’t remember exactly