· Nov 18, 2016

How to declare TSQL variable over JDBC connection?

I'm trying to use the standard TSQL DECLARE syntax but I get the following error:

[%msg: < IDENTIFIER expected, @ found^  DECLARE @>]

How do I declare a variable?  For instance:

DECLARE @numrecords int = 10;
SELECT TOP @numrecords FROM mytable;
Discussion (3)0
Log in or sign up to continue