How to used stored procedure of (SQLSERVER) in strapi?

I have already created a Database in the SQL server I want to use this database in strapi for publishing API. and how to get the local database into strapi ?
And how to get data from the database and saved into the database?

As far as I know Strapi doesn’t support MSSQL but… if you want to use your existing MSSQL based framework + Strapi there is a workaround:

  • install Strapi with --quickstart argument (it will create a Sqlite db)
  • create the same schema in Strapi
  • import your existing data into that db
  • link Sqlite with MSSQL using an online tutorial like this one

From that point on you can use Strapi Admin UI to manage the data, to create new Web interfaces for it, while you will be abe to use the resulting data in your existing framework.
All the new data will be updated in your linked MSSQL server.

I didn’t test this setup, and I’m not an expert, if someone else knows a better solution I’ll be glad to hear it…

Yes you are correct, we do not currently nor plan to support MSSQL

Yes, thank you for your reply. the setup is working properly. just another issue that I want to call stored procedure in strapi? is that possible using admin UI or need some programmatically changes?
now I’m able to publish existing DB, but how to call stored procedure in Mysql using strapi? if anyone having experience then please let me know

Yes, they told that they not start supporting mssql without it becoming a big burden for Strapi Community. so I hope they can make it easy to extend/create custom connectors in the future.and also they told us that we don’t currently plan to support other databases at this time and will be making steps easier to allow for community connectors.

To call stored procedures on specific api calls you have to customize your Strapi app controller or service, depending on situation. There is no way to provide you a solution, because there are too many variables in this ecuation. You need to start learning Strapi, I’m not an expert either, read this about how to customize Strapi controllers or services..
For periodic calls Strapi has even cron task similar to those in Linux.

I think you should call stored procedures not in Strapi, but in your existing frontend web framework, I suspect that you use there which is way more apropriate for such jobs. I see this setup Strapi + mssql based web framework where Strapi is the place where you add and organize data, and the mssql based framework a place where you actually consume that data (and maybe, editing existing fields). Hope it make sense.

That is absolutely our intention, we will be refactoring the strapi-database package to be able to support additional strapi-connector-* packages in the future to allow the community to build and manage their own connectors (Sequalize comes to mind as a previous request instead of Bookshelf/Knex)

1 Like

Hello, What’s the point today about that refactoring ?

@Cris_Cirhuza these plans have been more or less abandoned at this point.