CodeIgniter Forums
Heterogeneous queries - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Heterogeneous queries (/showthread.php?tid=58269)



Heterogeneous queries - El Forum - 05-29-2013

[eluser]anyamanggar[/eluser]
Guys, i have question,
i used mssql for database, and i use link server for my table in sql server 2005

Code:
select * from [server-31].inventaris.dbo.users
create view v_useregis as select * from [server-31].inventaris.dbo.users
select * from v_useregis

i use that code in sql server 2005, i can see the data, but when i put into controller

Code:
public function data_user(){
    
    $this->db->select('*');
    $query = $this->db->get('v_useregis');
    if($query->num_rows() > 0)
    {
     $row = $query->result();
     }
    $this->output->set_content_type('application/json');
         $this->output->set_output(json_encode($row));
    
    }

and then i show errorr like this

Quote:A Database Error Occurred

Error Number:

Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.

SELECT * FROM v_useregis

Filename: C:\xampp\htdocs\workflow\system\database\DB_driver.php

Line Number: 330

there's something wrong in my code? please help me if somebody else know how to fix it. thank you


Heterogeneous queries - El Forum - 05-29-2013

[eluser]TheFuzzy0ne[/eluser]
Sorry, I don't know anything about MS SQL Server. Google is your friend. Smile


Heterogeneous queries - El Forum - 05-29-2013

[eluser]Pert[/eluser]
http://stackoverflow.com/questions/10300322/heterogeneous-queries-require-the-ansi-nulls-and-ansi-warnings-options-to-be-set

Looking at the last comment you might be able to dynamically set these options running few special SQL queries when your application starts, before making any real queries to your data.