I would like to use TMSQuery to create a parametric command.
I usually do
MSQuery1.SQL.Text := 'CREATE DATABASE ' + aMyDBName;
but if I have
CREATE DATABASE :MyDBName
and i try to do
MSQuery1.ParamByName('MyDBName').asstring := aMyDBName;
when i execute the query i have
"Wrong syntax near @P1"
how to avoid this error and use ParamByName succesfully in my context?
Thanks
How to create a command passing parameters
Re: How to create a command passing parameters
You cannot pass the database name as a parameter in this query, since this functionality is not supported by MS SQL Server and we cannot affect it. To solve this task, you can use macros. More details about macros here: https://www.devart.com/sdac/docs/index. ... macros.htm
Re: How to create a command passing parameters
Thanks for the reply, now i got the difference between parameter and macro.