Sql server 2008 JPA2.0是否支持SQL Server表变量?
我使用的是JPA2.0和SQLServer2008,我已经确定,当我使用表变量时,JPA不喜欢我的存储过程 例如,此存储过程可以工作:Sql server 2008 JPA2.0是否支持SQL Server表变量?,sql-server-2008,stored-procedures,jpa-2.0,Sql Server 2008,Stored Procedures,Jpa 2.0,我使用的是JPA2.0和SQLServer2008,我已经确定,当我使用表变量时,JPA不喜欢我的存储过程 例如,此存储过程可以工作: declare @t table ( id int identity , test varchar(50) ) select 'blah' as test -- I'm ignoring the table variable above 但是,当我尝试使用此代码将某些内容插入表变量@t时,它崩溃了: declare @t tab
declare @t table
(
id int identity
, test varchar(50)
)
select 'blah' as test -- I'm ignoring the table variable above
但是,当我尝试使用此代码将某些内容插入表变量@t
时,它崩溃了:
declare @t table
(
id int identity
, test varchar(50)
)
insert into @t
select cast(getdate() as varchar(60))
select * from @t
我得到以下错误:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.
Error Code: 0
如果可以的话,我不想重写复杂的存储过程而不使用表变量
谢谢您的建议。随机思考:尝试添加“设置无计数” 你的代码
insert into @t
select cast(getdate() as varchar(60))
select * from @t
…我会退回这个
(1 row(s) affected)
id test
----------- --------------------------------------------------
1 Jun 14 2011 3:58PM
(1 row(s) affected)
SQL Server中实际有三个结果“项”。第一个没有关联的结果集
。。。我的问题中有一个无耻的插件,其中提到了破坏ORMs之类的东西,因为这个,在第二种情况下,存储过程返回两个结果集。第一个是执行INSERT语句的结果消息。我没有意识到这一点。你说得对+上午1点!就这样+如果可以的话,10万。谢谢你的接球!sql server ftf