'where appropriate, issue "select scope_identity()" in the same
statement.
Background on why "scope_identity()" is preferable to "@@identity":
http://msdn.microsoft.com/en-us/library/ms190315.aspx
Background on why we attempt to embed "scope_identity()" into the same
statement as the INSERT:
http://code.google.com/p/pyodbc/wiki/FAQs#How_do_I_retrieve_autogenerated/identity_values?'

def pre_exec(self):

    super(MSExecutionContext_pyodbc, self).pre_exec()
    if (self._select_lastrowid and self.dialect.use_scope_identity and len(self.parameters[0])):
        self._embedded_scope_identity = True
        self.statement += ';    select    scope_identity()'
