I'm trying to create a Model base on Native SQL query, which using Declare variable for shorten SQL and easier handling, the SQL run well, but whenever I change it to Model, it keep put all SQL query in Select .. From and come up with "Incorrect syntax near the keyword 'DECLARE'"
Is there anyway I can create all the Model base on Native Sql query manually or any other way to make this posible?
So Metabase doesn't like stored procedures, so I would avoid them as much as possible. We have customers who run SQL questions that are stored procedures, but running a question of a stored procedure or a model is 99% probability of failure (since metabase wraps stuff)
Thanks for your reply, but even if I dont wanna use Procedures, my query still need a lot of variable, for shorter and easier to handle.
I wish that instead of AUTOMATICAL add SELECT...FROM... AS "source", I can edit it in Edit Query Definition and manualy put SELECT where valid for SELECT SQL syntax (notice that the query run well until it automaticaly put in the SELECT...FROM... AS "source").