Contents tagged with database

  • Don't be affraid of RCSI

    Enabling SQL Server RCSI

    RCSI is not something you get from typing too much, it's a setting in MS SQL Server that is disabled by default. Arguably it shouldn't be. It stands for Read Committed Snapshot Isolation and when enabled means that you can select data from the database with less risk of locks and also know that the data you're getting was accurate when you started the request.

    I enabled it after we we started to see a lot of failed transactions in the logs due to timeouts on requests for locked resources. The thing that confused me was the locks were being taken out for transactions that were only doing … more

  • Simple SQL Server Database Schema Printer (ASP.NET)

    I created this simple app recently to print out all the tables in an SQL Server database. It shows each table's name, description and information about all its columns. I mainly use it when I start on a new project that has an existing database that I need to fully understand.

    This is an ASP.NET app, but it's based on the code from Jim Rutherford's ASP SQL Server Schema Printer.

    It's just an ASP.NET page. First you need to add your database connection string and then you upload it to your webserver.

    You can download it from here:

    Simple SQL Server Database Schema Printer (ASP.NET)

    more

  • Sending a list into an SQL stored procedure using XML

    I wanted to pass a list of user IDs into a stored procedure. What I really wanted was to be able to pass an array, but you're not able to do that because it would be too easy. It took me quite a while to figure this out, but now I know how, it'll be easy next time.

    There's a nice set of functions that allow you to get values from an XML string and treat the set of values like a table. Just what I wanted from arrays really.

    Here is the XML string that I used:

    <users><user id="24" /><user id="27" /></users>

    And here is the relevant part of the stored procedure I made: … more

  • 1