cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

calling sql sequence in Thingworx

Highlighted
Participant

calling sql sequence in Thingworx

Hi,

 

I am trying to call a Sql sequence in Thingworx . i wrote a sql query service in a thing and tried executing it. But it shows the following error "Execute Query failed: com.microsoft.sqlserver.jdbc.SQLServerException: NEXT VALUE FOR function cannot be used if ROWCOUNT option has been set, or the query contains TOP or OFFSET.

 

how to resolve this?

 

Thanks in Advance

Sadagopan P

Tags (2)
3 REPLIES 3
Highlighted

Re: calling sql sequence in Thingworx

This is not a TWX issue.  I'd suggest reading up on proper SQL query implementation.

https://docs.microsoft.com/en-us/sql/t-sql/functions/next-value-for-transact-sql?view=sql-server-ver...

 

If you tried executing your query directly in SQL Manager, you'd get the same error.

Highlighted

Re: calling sql sequence in Thingworx

I tried in the SQL manager, and actually am not getting that error which i get when i execute the same in thingworx

Highlighted

Re: calling sql sequence in Thingworx

Hi,

 

Instead of executing the sequence as an query separately, i added ' next value for "sequence name" ' in the insert command values itself. like, insert into tablename (id) values (next value for sequenceName) . This solved kind of solved the aforementioned issue.

 

But, I have another similar issue here.

 

When i execute a stored procedure in thingworx as SQL query am getting that same old error "NEXT VALUE FOR function cannot be used if ROWCOUNT option has been set, or the query contains TOP or OFFSET." i tried executing this specific procedure in sql directly, it works fine there. But while executing it in Thingworx am getting this error. 

 

Can I get some help regarding this?

 

Thanks,

Sadagopan Ponmani.

 

 

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!