     _doTargetTable: (name) ->
         fullName = @parseWhenRawName(name)
         schema = @_findTableSchema(fullName)
-        @sources.push(_schema: schema) if schema?
+        if schema?
+            @sources.push(_schema: schema)
+            @targetTableSchema = schema
+
         return @_doToken(fullName, schema)
 
     insert: (i) ->

    naryOp: (op, atoms) ->
        switch op
            when 'isNull'
                pieces = ("#{@_doAtom(a)} IS NULL" for a in atoms)
            when 'isntNull', 'isNotNull'
                pieces = ("#{@_doAtom(a)} IS NOT NULL" for a in atoms)
            when 'isGood'
                pieces = []
                for a in atoms
                    s = @_doAtom(a)
                    pieces.push("#{s} IS NOT NULL AND LEN(RTRIM(LTRIM(#{s}))) > 0")

        return pieces.join(' AND ')

    binaryOp: (left, op, right) ->
        l = @_doAtom(left)
        
        sqlOp = operatorAliases[op] ? op.toUpperCase()
        


    where: (c) -> if c.whereClause? then " WHERE #{(c.whereClause.toSql(@))}"  else ''

    groupBy: (c) -> @doList(c.groupings, @_doColumnAtom, ', ', ' GROUP BY ')

    orderBy: (c) -> @doList(c.orderings, @ordering, ', ', ' ORDER BY ')

    ordering: (o) ->
        s = @_doColumnAtom(_.firstOrSelf(o))
        dir = if _.secondOrNull(o) == 'DESC' then 'DESC' else 'ASC'

        "#{s} #{dir}"
