Comments on: How to call or execute a Stored Procedure from inside a Select Statement https://sqlserverlearner.com/2012/05/09/how-to-call-or-execute-a-stored-procedure-from-inside-a-select-statement/ LEARN SQL SERVER ONLINE Tue, 16 Jul 2013 12:14:58 +0000 hourly 1 https://wordpress.org/?v=6.5.2 By: Rahul https://sqlserverlearner.com/2012/05/09/how-to-call-or-execute-a-stored-procedure-from-inside-a-select-statement/comment-page-1/#comment-1032 Tue, 16 Jul 2013 12:14:58 +0000 https://sqlserverlearner.azurewebsites.net/2012/05/09/how-to-call-or-execute-a-stored-procedure-from-inside-a-select-statement/#comment-1032 SELECT * FROM OPENROWSET(‘SQLNCLI’
,’Server=(local);Trusted_Connection=Yes;Database=Master’
,’exec dbo.sp_getNewID A,13,@id)’)

Getting below error
Msg 15281, Level 16, State 1, Line 1
SQL Server blocked access to STATEMENT ‘OpenRowset/OpenDatasource’ of component ‘Ad Hoc Distributed Queries’ because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of ‘Ad Hoc Distributed Queries’ by using sp_configure. For more information about enabling ‘Ad Hoc Distributed Queries’, search for ‘Ad Hoc Distributed Queries’ in SQL Server Books Online.

]]>
By: Richard Parks https://sqlserverlearner.com/2012/05/09/how-to-call-or-execute-a-stored-procedure-from-inside-a-select-statement/comment-page-1/#comment-1031 Sat, 16 Feb 2013 00:51:18 +0000 https://sqlserverlearner.azurewebsites.net/2012/05/09/how-to-call-or-execute-a-stored-procedure-from-inside-a-select-statement/#comment-1031 Appreciate your post.

This has some other good references regarding T-SQL EXEC statement:
http://msdn.microsoft.com/en-us/library/ms188332(SQL.105).aspx

]]>