on ‎2011 Jun 28 7:11 PM
I'm trying to use table variables in a SQL query in MII 12.1 SP8 Build 43 using MSSQL Server 2005. I'm using MSSQL JDBC driver 3.0 "sqljdbc.jar". I'm not having any luck using table variables (I'm not using these in a stored procedure, just a query template) Mode is fixedquery. For various reasons, creating a stored procedure is not an easy option for me in the environment.
As a test I've tried the following query, which works fine in SQL Server Management Studio.
SET NOCOUNT ON
DECLARE @Temp TABLE
(
Col1 int IDENTITY(1,1) NOT NULL,
Col2 varchar(2),
Col3 datetime
)
INSERT INTO @Temp Values ('1',GETDATE())
SELECT Col1,Col2,Col3
FROM @Temp
I get "com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set."
Has anybody else run into this issue? I ran into this in 11.5 but that was with version 1.0 of the SQL JDBC driver.
UPDATE I just tried this with sqljdbc4.jar on my sandbox, with the same result.
Edited by: Doug Holtke on Jun 28, 2011 8:41 PM
Request clarification before answering.
I get the same error if I try to use temp tables. It seems that version 3.0 of the JDBC driver seems to ignore the command "SET NOCOUNT ON"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
On a 12.1.x system, I pasted your query in a new template and received 1,1,timestamp in the resultset. The selected Data Server was configured with the Una2000.jar driver (com.inet.tds.TdsDriver)
I get the same error you mentioned when using another Data Server configured to use the sqljdbc.jar driver(com.microsoft.sqlserver.jdbc.SQLServerDriver)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.