Can you call stored procedure from function




















SQL Server tabular function is a program that can be used to return data by joining the multiple tables. Essential standard conventions of comparing a function with the procedure are listed below;. If you do not specify the database in connection and query statement, then the query will return an error as below:.

Users can insert those rows into the temp table or table variable to process it further. The above samples include the number of scenarios of procedure integration with the function, including error handling. Now, it turns out to be simpler for the users who want to include this methodology in the existing database structure.

In all of the above sample codes, the SQL Server instance name is used as a localhost because it performed each task on the local machine. However, it should be the instance name of the SQL Server. If users want to execute the procedure on a remote server, then remote SQL Server name can be used instead of the localhost and that remote SQL Server instance name must exist in your linked servers list.

The use of procedures inside the function could be required when users are integrating the third-party application in the database. This requirement cannot be directly dealt with by the function, and direct use of the SQL Server procedure inside the function is not a standard solution for the same. What problem are you trying to solve? Ahh, I see. Ed Wagner. Any time a username and password has to be hard coded means that you're screwed if you ever change the password.

Or you have to try to maintain a list of everywhere you hard code login credintials and the list becomes obsolete and you end up chasing them down anyway. I like Gail's answer of "No" myself.

Just because we can do something doesn't mean we should. The technical workaround does work, but I don't think it's a good idea. I apologize if I got on a soap box there. I've been burned by that in the past and don't want others to have to suffer the same misery without know it's coming.

When you do the openrowset hack, if anything you call has side effects changes data, changes structure, creates files, etc could create incorrect, inconsistent results or even errors, depending what happens behind the scenes. Thank you, Gail. Yet another reason not to use it to get around the built-in limitations. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Does ES6 make JavaScript frameworks obsolete?

Podcast Do polyglots have an edge when it comes to mastering programming Featured on Meta. Now live: A fully responsive profile. Linked 4. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled.

Accept all cookies Customize settings.



0コメント

  • 1000 / 1000