Reputation: 11
I don't know how to operate MySQL DECLARE THIS TABLE?
MS_SQL CAN
DECLARE @TEMP TABLE
(variable INT)
But MySQL
can't do this! How can i do it?
Syntax error !!
Upvotes: 1
Views: 5085
Reputation: 142298
If you need to make a table or database name come from an argument or variable, you will need to
CONCAT
.PREPARE
the query.EXECUTE
the query.DEALLOCATE PREPARE
.Upvotes: 0
Reputation: 562358
MySQL does not have the feature of declaring a variable for a table. Variables can only be scalars.
If you need a feature that Microsoft SQL Server supports, then you should use Microsoft SQL Server.
Also when you use DECLARE
in MySQL, you can't use the @
sigil on variables. Local variables in stored routines don't have that sigil in MySQL. This is another difference from Microsoft SQL Server.
Upvotes: 1