Clone/Copy SQL Server Database with timestamp in name

This script works on Azure SQL Database also.

 DECLARE @cmd nvarchar(255) SET @cmd = N'CREATE DATABASE ' + CONCAT('MyDB_', REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(16), GETDATE(), 120), '-', ''),':',''),' ','_')) + ' AS COPY OF MyDB' EXECUTE sp_executesql @cmd 

Enable Windows Explorer previews for custom file types

Coders, have you ever wished if you get preview of source code while you are in Windows Explorer? Yes it is possible. You might know already that there is a “Preview Pane” feature present. According to a file’s Content Type the preview will be shown at the right side of the window. Common formats supported are – .txt, .mp4, .jpg etc.

image

BUT, most of the developer’s files like .cs, .php, .config, .log files are not supported by default and you will be presented with a message “No preview Available” like this:

image

How to enable preview for a specific filetype?

Step 1: Go to Regedit. Expand the node HKEY_CLASSES_ROOT

Step 2: look for your required extension, eg: .php (If the extension is not already present, then create a key)

Step 3: Add a string value PerceivedType and set its Data to text

Voila!, your file preview is ready!

image