SQL CREATE Table Name with System defined variable
Hello all,
I am still learning CACHE and have below question.
In one of my ZEN method i am creating a table using
&sql(CREATE TABLE xxxxx(TNAMESPACE CHAR(100),TINTERFACE CHAR(100)))
Does any one knows how to concatenate a $USERNAME or any content of a variable to the name of table ?
&sql(CREATE TABLE xxxxx_$USERNAME(TNAMESPACE CHAR(100),TINTERFACE CHAR(100))) is not WORKING.
Thanks,
Jimmy Christian.
Discussion (2)0
Comments
s res=##class(%SQL.Statement).%ExecDirect(,$$$FormatText("CREATE TABLE %1 (TNAMESPACE CHAR(100),TINTERFACE CHAR(100))",$$$quote("xxxxx"_$USERNAME)))
w res.%SQLCODEThank you . This is perfect !
I just tweaked it little bit
SET testingddl="CREATE TABLE xxxxxxx"_$USERNAME_"(TNAMESPACE CHAR(100),TINTERFACE CHAR(100),TPORT INT)"
s ret=##class(%SQL.Statement).%ExecDirect(,.testingddl)