none
PHP to MSSQL via sqlsrv, get error: Operand type clash: nvarchar is incompatible with image RRS feed

  • 问题

  • I have multiple SQLTYPEs in one php SQL insert query, how to set them?

    <?php
    $params = array(
     0000000000000000000120745,    //"ACO_ID" NCHAR(25) NOT NULL,
     162,   //"ACO_FILE_LENGTH" NUMERIC(12,0) NOT NULL,
     2017-04-20 02:29:42,     //"ACO_CREATED_DATE" DATETIME(3) NOT NULL,
     0,          //"ACO_DELETED" TINYINT(3,0) NULL DEFAULT NULL, 
     "CAR",      //"ACO_ENTITY_ID" NCHAR(25) NULL DEFAULT NULL,
            "0x53454c45435420544f50203530204241485f49442046524f4d204241485f424153455f4154544143484d454e545f47454e204f52444552204259204241485f435245415445445f444154452044455343",  //"ACO_CONTENT" IMAGE(2147483647) NULL DEFAULT NULL,
      );
     
    $sqlstr = "INSERT INTO ACO_ATTACHMENT (ACO_ID, ACO_FILE_LENGTH, ACO_CREATED_DATE, ACO_DELETED, ACO_ENTITY_ID,  ACO_CONTENT) ".
               "VALUES (?,?,?,?,?, ?)";
              
    $stmt = sqlsrv_prepare($conn, $sqlstr, $params);   
    $result = sqlsrv_execute($stmt);

    /*
    Error:
    [Microsoft][SQL Server Native Client 11.0][SQL Server]Operand type clash: nvarchar is incompatible with image
    */      
    ?>

    2017年4月20日 3:26