Jun
19
2010

Simple trick to run Microsoft SQL [MSSQL] Stored procedures in PHP



I had  lot of problems and difficulties to run Microsoft SQL stored procedures in PHP but i found a simple trick to do it easily and i think it will be helpful for you all :)

Running stored procedures  using Microsoft SQL in PHP with MSSQL interface.

1.Create the Stored procedure in Microsoft SQL management studio and check in the query analyzer if the stored procedure executes with out no errors  .

2.Create the MSSQL database connections in a PHP class or a PHP file

3.In Microsoft SQL management studio go to :

Database –> YourDatabaseName –> Programmability –>  Stored procedures –> Execute the Stored Procedure

Right click the procedure name -> Execute

Stored procedure execution window

Get this code to a PHP String and Exicute it using mssql_query() as a normal database query execution

If the stored procedure output is a reutrn value $row=mssql_fetech_array($result)

$row[''''''''''''''''Return Value''''''''''''''''];

if its a variable use $row[''''''''''''''''Variable Name''''''''''''''''];


4 Comments + Add Comment

  • Useful post… I”ve never worked with MSSQL and PHP… should try it when i find some time ;-)

  • Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I””ll be subscribing to your feed and I hope you post again soon.

  • Heyy, Found your blog on Google and I will definatley be recommending and coming back to the site! =)

  • Thanks for ones blog loaded with so numerous information. Stopping by your blog helped me to get what I was seeking for.