Archive for the ‘SQL’ Category

Grant a MS SQL login Read Only access to ALL databases

 Here is a SQL code snippet I used today that loops through all the databases on a server and creates a SQL script that will give a user Read Only access to all databases (including system databases).  

Posted on June 3, 2013 at 20:16 by simon · Permalink · Leave a comment
In: SQL

Simple script to backup all databases at once

Script to backup all non system databases To backup all your MS SQL databases quickly on a SQL instance use the following script in a new query window. You must change the “SET @path” string to a suitable location.

Posted on March 21, 2013 at 20:00 by simon · Permalink · Leave a comment
In: SQL · Tagged with: , , ,

Setting SQL Server to accept date in DD/MM/YYYY format

I’ve been working on a web based database project for the wifes business and during development I realised that half of the dates where being saved in M-D-Y format. As I live in the UK we use the correct date format which is D-M-Y obviously ;). The problem turned out to be a single settings […]

Posted on December 3, 2012 at 23:22 by simon · Permalink · One Comment
In: ASP.NET, SQL, Tech · Tagged with: , , ,

Cannot shrink transaction log SQL 2005

If you ever come across a MS SQL 2005 transaction log that refuses to shrink, this little bit of code might help you out.

Posted on July 28, 2012 at 20:12 by simon · Permalink · Leave a comment
In: SQL · Tagged with: , ,

T-SQL Example code: Select, Insert, Update, Delete

Various examples and snippets of Select, Insert, Update, Delete T-SQL

Posted on July 12, 2012 at 23:48 by simon · Permalink · Leave a comment
In: SQL · Tagged with: , , ,

T-SQL Example code: Table Management

T-SQL table management tips, tricks and code snippets

Posted on July 12, 2012 at 23:43 by simon · Permalink · Leave a comment
In: SQL · Tagged with: , , , , , ,

T-SQL Example code: useful stores procedures and snippets

Here are some useful one liners that I find very useful

Posted on July 12, 2012 at 23:41 by simon · Permalink · Leave a comment
In: SQL · Tagged with: , , , , , , , , ,

T-SQL Example code: User Management

Some useful commands for dealing with users (in a non violent way), and a very useful couple of lines for finding and then fixing orphaned users which often happens after moving a database to a differnet SQL server.

Posted on July 12, 2012 at 23:38 by simon · Permalink · Leave a comment
In: SQL · Tagged with: , ,

T-SQL Example code: Database Management

Here is some code that Iv’e found useful for managing databases:

Posted on July 12, 2012 at 23:37 by simon · Permalink · Leave a comment
In: SQL · Tagged with: , , , , , , , ,

T-SQL Example code: SQL Fixes

Here are a few lines of code that have got me out of troubel in the past:

Posted on July 12, 2012 at 23:29 by simon · Permalink · Leave a comment
In: SQL · Tagged with: , ,