![]() |
MSSQL Cast/Convert - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: MSSQL Cast/Convert (/showthread.php?tid=71360) |
MSSQL Cast/Convert - matrx - 08-05-2018 Hello! How can I use Query Builder Class in MSSQL 2008 Convert/Cast varchar to binary. Code: $DB1->update('tbl_User', array('uilock_pw' => '0x'.bin2hex($this->input->post('FG')),'uilock_hintanswer' => '0x'.bin2hex($this->input->post('FG_ans'))), array('id' => $this->input->post('acc'))); [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Implicit conversion from data type varchar to binary is not allowed. Use the CONVERT function to run this query.</p><p>UPDATE "tbl_UserAccount" SET "uilock_pw" = '0x3131313131313131', "uilock_hintanswer" = '0x3131313131' WHERE "id" = 'user' Code: $DB1->update('tbl_User', array('uilock_pw' => bin2hex($this->input->post('FG')),'uilock_hintanswer' => bin2hex($this->input->post('FG_ans'))), array('id' => $this->input->post('acc'))); [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Implicit conversion from data type varchar to binary is not allowed. Use the CONVERT function to run this query.</p><p>UPDATE "tbl_UserAccount" SET "uilock_pw" = '3131313131313131', "uilock_hintanswer" = '3131313131' WHERE "id" = 'user' Code: $DB1->update('tbl_User', array('uilock_pw' => '(CONVERT (binary,'.$this->input->post('FG').'))','uilock_hintanswer' => '(CONVERT (binary,'.$this->input->post('FG_ans').'))'), array('id' => $this->input->post('acc'))); [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Implicit conversion from data type varchar to binary is not allowed. Use the CONVERT function to run this query.</p><p>UPDATE "tbl_UserAccount" SET "uilock_pw" = '(CONVERT (binary,11111111))', "uilock_hintanswer" = '(CONVERT (binary,1111))'WHERE "id" = 'user' Sorry, my bad English. Thanks! |