无法在 IBatis 中创建临时表



我无法在我的 ibatis SQL 查询 (#table) 中使用临时表。此查询在 SQL Server 上执行。

DECLARE @file_id int
SET @file_id  = 38--#FileID# 
SELECT * INTO #NotFinishedRecords FROM TABLE

以下是使用 xml 映射器在 IBATIS 中创建临时表的示例:

<sqlMap namespace="xxx" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <select id="GetTempTableData" resultClass="xxx" parameterClass="System.String">
      Create table ##TestTable(ID varchar(20), Name varchar(100))
      Insert into ##TestTable values('1001-101','ABC')
      Insert into ##TestTable values('1001-102','XYZ')
      Select * from ##TestTable
  </select> 
</sqlMap>

最新更新