lib/active_record/connection_adapters/sqlserver/schema_statements.rb
# === SQLServer Specific (Identity Inserts) ===================== #
SQLServer Specific (Identity Inserts)
SQLServer Specific ( Identity Inserts )
def query_requires_identity_insert?(sql)
          if insert_sql?(sql)
            table_name = get_table_name(sql)
            id_column = identity_column(table_name)
            id_column && sql =~ /^\s*(INSERT|EXEC sp_executesql N'INSERT)[^(]+\([^)]*\b(#{id_column.name})\b,?[^)]*\)/i ? quote_table_name(table_name) : false
          else
            false
          end
        end
def query_requires_identity_insert? ( sql ) if insert_sql? ( sql ) table_name = get_table_name ( sql ) id_column = identity_column ( table_name ) id_column && sql =~ / ^ \s *(INSERT|EXEC sp_executesql N'INSERT)[^(]+ \( [^)]* \b ( #{ id_column . name } ) \b ,?[^)]* \) /i ? quote_table_name ( table_name ) : false else false end end
SQLServer Specific (Identity Inserts)
SQLServer Specific ( Identity Inserts )
sql
<not_specific>