Script to retrieve a list of databases with the associated recovery model. Useful for checking backups.
I was having problems with SSMS (SQL Server Management Studio) which I have been running with administrator permissions, whereby I couldn’t open files on my mapped network drives.
Doing a bit of Google’ing, I came across this article – https://technet.microsoft.com/en-us/library/ee844140(v=WS.10).aspx
I have developed a script that can be used to archive offline databases. This script first brings the databases online, then backs them up, detaches them, and then moves the MDF and LDF files.
I have just improved the script in SQL: List of table columns, with data types:
It now includes an indicate for nullable fields, primary and foreign keys, unique and check constraints, and identity columns
Question asked by Pramod on my old Forum.
I have decided to do away with my forum plugin, and instead have added the Ask a question/Contact Me page. All forum posts have been added as regular posts, with “Question:” at the start of the post title.
The example query below creates a product category table and populates it with sample data. I then use a CTE query to return the categories, along with the breadcrumb trail (lineage)
The script in this post can be used to obtain an example of each of the different styles that can be output using the CONVERT Transact-SQL statement when converting date/time to a string. I have output the styles including the century, but the script can easily be modified to output examples without.