Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How stupid can SQL be?
Message
From
02/04/2019 08:39:09
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
How stupid can SQL be?
Miscellaneous
Thread ID:
01667824
Message ID:
01667824
Views:
79
Trying to restore a database backup I got from a client. Nothing new, no surprises. But SQL server (this time SQL2012) just flatly refused to restore to the location where the database should go (q:\rad\db\data\) because the path "c:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\" didn't exist. I actually had to create the bloody location just for this. Then again it wouldn't restore, because of "SQL Server Database Error: The operating system returned the error '5(Access is denied.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\blabla.mdf'." I had to add the "NT Service\MSSQL$SQEX12" user to that folder and give it full rights.

Now I understand why the script has to say
WITH replace, FILE = 1,
move N'blabla' to N'q:\rad\db\DATA\blabla.mdf',
move N'blabla_log' to N'q:\rad\db\DATA\blabla_log.ldf',...
- because it actually doesn't know how to restore to a different location, so it restores to where it originally was and then MOVES the files to where they go.

What was it that you were teaching us all those years about hardcoded paths, Microsoft?

Set Rant Half

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Next
Reply
Map
View

Click here to load this message in the networking platform