title: ODBC Driver 17 for SQL Server incorrect syntax near . ''
body: <p>I am trying to create table in MS SQL server management 17 using php.</p>
  
  <p>my query is:</p>
  
  <pre><code>                            $mid=$row['MASTER_ID'];
                              echo $mid;
                              $table_solution="CREATE TABLE Q_MASTERID_'$mid'_Solution(
                                              MASTER_ID INT ,  
                                              PRODUCT_NAME varchar(255),
                                              CUSTOMER_NAME varchar(255),
                                              Q_TEMP_ID INT IDENTITY(1,1),
                                              Q_DESC nvarchar(600) NULL,
                                              Q_CATEGORY nvarchar(255)  NULL,
                                              Q_SUB_CATEGORY nvarchar(255) NULL,
                                              SCOPE nvarchar(255) NULL 
                                              ) ON PRIMARY"; 
  
                              $solution_alter="ALTER TABLE Q_MASTERID_'$mid'_Solution ADD Q_ID AS CONCAT ('A',CAST(Q_TEMP_ID AS VARCHAR(100)))PERSISTED" ;
  
                               $res=sqlsrv_query($con,$table_solution) or die("Couldn't execute create query".print_r(sqlsrv_errors(), true));
                              $res1=sqlsrv_query($con,$solution_alter) or die("Couldn't execute alter query");
  </code></pre>
  
  <p>i am getting following error :</p>
  
  <blockquote>
    <p>Couldn't execute create queryArray ( [0] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 102 [code] => 102 [2] => [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near ''. [message] => [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near ''. ) )</p>
  </blockquote>
  
  <p>if i remove $mid in create query im getting following error</p>
  
  <blockquote>
    <p>Couldn't execute create queryArray ( [0] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 156 [code] => 156 [2] => [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword 'PRIMARY'. [message] => [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword 'PRIMARY'. ) )</p>
  </blockquote>
  
  <p>i want to add dynamic variable called $mid while creating table "CREATE TABLE Q_MASTERID_'$mid'_Solution" 
  help me to resolve this...</p>