cbm*_*eks 2 stored-procedures sql-server-2008 jpa-2.0
我正在使用JPA 2.0和SQL Server 2008,并且当我使用表变量时,我已经确定JPA不喜欢我的存储过程.
例如,这个sproc工作:
declare @t table
(
id int identity
, test varchar(50)
)
select 'blah' as test -- I'm ignoring the table variable above
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试@t使用此代码将某些内容插入到表变量中时,它会崩溃:
declare @t table
(
id int identity
, test varchar(50)
)
insert into @t
select cast(getdate() as varchar(60))
select * from @t
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
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
Run Code Online (Sandbox Code Playgroud)
如果我可以帮助它,我不想重写我的复杂sprocs而不使用表变量.
谢谢你的任何建议.
随机想一想:尝试添加SET NOCOUNT ON.
你的代码
insert into @t
select cast(getdate() as varchar(60))
select * from @t
Run Code Online (Sandbox Code Playgroud)
......会回来的
(1 row(s) affected)
id test
----------- --------------------------------------------------
1 Jun 14 2011 3:58PM
(1 row(s) affected)
Run Code Online (Sandbox Code Playgroud)
SQL Server 中实际有三个结果"项".第一个没有任何结果集.
...还有一个无耻的插件我的问题SET NOCOUNT ON用途,因为这样就提到破坏ORM等
| 归档时间: |
|
| 查看次数: |
2737 次 |
| 最近记录: |