Commits

Michael Manfre  committed b007ebc

Don't alter empty UPDATE sql

  • Participants
  • Parent commits 2fe366a

Comments (0)

Files changed (1)

File sqlserver_ado/compiler.py

 class SQLUpdateCompiler(compiler.SQLUpdateCompiler, SQLCompiler):
     def as_sql(self):
         sql, params = super(SQLUpdateCompiler, self).as_sql()
-        # Need the NOCOUNT OFF so UPDATE returns a count, instead of -1
-        sql = 'SET NOCOUNT OFF; {0}; SET NOCOUNT ON'.format(sql)
+        if sql:
+            # Need the NOCOUNT OFF so UPDATE returns a count, instead of -1
+            sql = 'SET NOCOUNT OFF; {0}; SET NOCOUNT ON'.format(sql)
         return sql, params
 
 class SQLAggregateCompiler(compiler.SQLAggregateCompiler, SQLCompiler):