Index: src/templates/sql/load/mssql/row.vm =================================================================== --- src/templates/sql/load/mssql/row.vm (revision 516599) +++ src/templates/sql/load/mssql/row.vm (working copy) @@ -14,7 +14,14 @@ ## KIND, either express or implied. See the License for the ## specific language governing permissions and limitations ## under the License. +#set($hasIdentity = false) +#foreach($col in $row.ColumnValues)#set($hasIdentity = $hasIdentity || $col.Column.autoIncrement)#end +#if($hasIdentity) +SET IDENTITY_INSERT $row.Table.Name ON; +#end INSERT INTO $row.Table.Name (## #set ($comma="")#foreach($col in $row.ColumnValues)$comma${col.Column.Name}#set($comma=",")#end) VALUES (#set ($comma="")#foreach($col in $row.ColumnValues)$comma${generator.parse("sql/load/mssql/val.vm", "", "column", $col)}#set ($comma=",")#end); - +#if($hasIdentity) +SET IDENTITY_INSERT $row.Table.Name OFF; +#end