I spent a few days playing with Ruby on Rails a while back. During the learning experience, there was one particular feature that I really liked. It was the database migration scripts that get automatically generated for you. I always wished I had something like this in the windows (asp.net) world. It turns out there […]
Entries Categorized as 'SQL'
Database Schema Compare & Upgrade
July 10, 2008
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
June 8, 2007
I had to uninstall and reinstall SQL server 2005 and Express on my development machine. After the un-installation, I reinstalled SQL 2005 standard then SQL Express. When I tried to open a SQL express database in VS2k5 I got the error “Failed to generate a user instance of SQL Server due to a […]
Custom sort order in a SQL statement
May 25, 2007
I tracked a status of a record in a text field and wanted to sort the results in a specific order. For example I want “active” to show before “rejected” and “deleted” to show up last, etc… It turns out it was pretty easy to do in SQL. Here it is:
select * […]
SQL Script to generate data inserts for existing tables
May 10, 2007
Here is a great sql script that will look at your table and generate a script to insert all the data. This is very useful when moving databases or when you want to create a database setup in your application with some default data. Note that I haven’t tried this procedure and it […]
Flip a SQL table around
April 10, 2007
I have a sql table that looks like this
Id
Name
Value
1
First name
Bob
1
Last name
Johns
2
First name
John
2
Last name
Smith
3
First name
Bill
3
Last name
Gates
I want to return the data like this:
Id
First name
Last name
1
Bob
Johns
2
John
Smith
3
Bill
Gates
I am completely lost and don’t even know where to start or what to search for… Any ideas?
For the time being, I used code to generate the required results, here it […]
Posted in
content rss
