Welcome Guest, Not a member yet? Register   Sign In
Loading a SQL file to run queries.
#1

So I have the following.. I am trying to load a SQL file like this.

$params = array(
  'foo' => 'test',
  'bar' => 'case'
);

$filename = 'test.sql';
$sql = $this->load->file($filename, true);
$query = $this->sedona_db->query($sql,$params); 


the 'test.sql' file looks something like this:

Declare @foo varchar(10) = ?
Declare @bar varchar(10) = ?

Select * ... something something where foo = @foo
Exec someStoredProc @foo

--------------------------------------

I would get an error msg like this:
mssql_query(): message: Must declare the scalar variable "@foo"(severity 15)
Reply


Messages In This Thread
Loading a SQL file to run queries. - by htaningco - 05-24-2018, 07:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB