Fixed selecting sequence identifier for MsSql2012

We can't use SCOPE_IDENTITY() with a sequence so we need to select the
value into a variable and work with that instead.