Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQLServerException: Incorrect syntax near / SQLServerException: Must declare the scalar variable

 
Rico Strydom
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

In my Java code I am getting an Sql Exception : .
When I remove all the U's from my statement then I am getting

This is my stored proc.



Can someone please help?
 
Dave Tolls
Ranch Hand
Posts: 2099
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you doing an EXEC in there?
Why not simply call the UPDATE directly?
 
Rico Strydom
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is a difference?
 
Dave Tolls
Ranch Hand
Posts: 2099
15
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, yes.
The EXEC is for interpreting and executing a string.
T-SQL can run queries directly.

It's the use of EXEC that's causing you your problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic