If you’ve lost a database log file and you’re in critical need of the data, well… that would never happen ( ͡° ͜ʖ ͡°) Nevertheless, this is might be a handy random fact to know, that you can attach a data (.mdf) file without the associated log (.ldf) file in SQL Server.
This post is a quick guide on how to export data from SQL Server into a CSV file. The default export to settings will try save your query as a column aligned .rpt file, so I’ll cover that below while converting to CSV format.
Backing up a database is something I’ve always found easier done within a query window. There’s not much to it; BACKUP DATABASE [DATABASENAME] TO DISK = N'e:\directory\databasename_backupdate.bak'
This script will delete rows within a table that are out-with the specified retention period. This can be useful if you’re running deletes on large tables, and particularly if;