![]() ![]() ![]() |
Ispirer SQLWays Database Migration Software
Conversion of Variable Declarations from Microsoft SQL Server to MySQL
The DECLARE statement is used to declare variables in Microsoft SQL Server and allows declaring variables with different data types. The MySQL DECLARE statement allows declaring a list of variables with one data type only, which is specified at the end of the variable list.
Microsoft SQL Server local variable name (@var) is changed to MySQL local variable name with the only difference that symbol "@" (which in Microsoft SQL Server designates local variable) is changed to MySQL "v_". In MySQL symbol "@" is used to designate user variable. User variable means that variable is working during the whole connection to the database. In our case we must used local variable, which works only within procedure body.
SQLWays used "v_" before local variable name for discern between local variable and column name. For example:
TABLE 18. Example, where column has the same name as variable (with "v_"): Microsoft SQL Server MySQL
TABLE 19. Example, where column has the same name as variable (without "v_"): Microsoft SQL Server MySQL
SQLWays converts the Microsoft SQL Server DECLARE statement with a list of variables to a standalone DECLARE statement for each variable in MySQL
![]() ![]() ![]() |