• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MSSQL Cast/Convert

#1
Exclamation 
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!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.