Stored procedure works correctly within SQL Management Studio, but in SQLTools no.
You see, SQL Tools does not process SQL statements in any way, we simply pass them -- as a string -- to the ODBC driver and say "please process this statement". So you are probably seeing a difference between 1) SQL Management Studio's syntax and 2) the syntax that the ODBC Driver is expecting. Neither of those things are under SQL Tools' control, of course, it all comes down to the specific syntax that is required by SQL Server.
Are you certain that you should use exec instead of call?
> apparently the IF is the problem
Then you'll need to investigate the IF syntax that the SQL Server ODBC driver requires. It's probably something subtle like a missing space, or the use of single quotes instead of double quotes, or some missing brackets...
Added: By the way, some of your code examples show a leading space before ' CANALETA' and some do not. Which is correct?
-- Eric
Leave a comment: