Welcome Guest, Not a member yet? Register   Sign In
Pass tablename,fields,values to Stored Procedure dynamically
#1

I am developing a custom application using CodeIgniter and MSSQL Server. Here i am using stored procedures.
Now i am wondering to implement codeigniter query type functionality where i can create a universal stored procedure in SQL Server and at the time of using i can pass tablename, array of fields and values.
It can work for both insert and update.



Something like we do in CodeIgniter to execute the query,

```

Code:
$data = array('fieldname1' => 'value1',
'fieldname2' => 'value2');

$this->db->insert($tablename,$data);

```

Just like this if we can pass the table name and array of the data to stored procedure and stored procedure automatically execute it.

If this can be done, it can save lots n lots of man hours. If anyone have already done i will be very much happy to see the solution.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB