Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

OPENROWSET and EXEC...

Posted on 2008-06-18
4
Medium Priority
?
1,193 Views
Last Modified: 2008-09-10
Hi, I'm using SQL SERVER 2005...
is it possible to use OPENROWSET with a EXEC command?

Something like:

SELECT *
FROM OPENROWSET('SQLOLEDB','localhost';'sa';'P@ssw0rd',
'sp_executeSQL N''MyDataBase..sp_GetMyData 2008, null, 4'' ') TblA

Strangely enough (or not) this doesn't work :)

Is it possible to make it work?

Thanks,
Alex
0
Comment
Question by:Alexandre Simões
3 Comments
 
LVL 2

Accepted Solution

by:
chuckatwork earned 2000 total points
ID: 21816334
You have to enable it via Surface Area Configuration tool.
0
 
LVL 30

Author Comment

by:Alexandre Simões
ID: 22437018
Sorry for leaving this so long but I never actually tried the solution.
We ended using a different approach at the business level so ended up not needing this.

I'm accepting it as it could be a cause.

Thanks,
Alex
0
 
LVL 51

Expert Comment

by:Mark Wills
ID: 24453387
just happened across this, and thought you might like to see how :

select * from openrowset('SQLNCLI', 'Server=MY_SVR_NAME;Trusted_Connection=yes;','EXEC MY_DB_NAME..USP_MY_SP null,null,null,null') a


Now, it will fail unless the stored procedure does have a predefined (ie at create sp time) list of columns. It is quite "sensitive" (read fussy).
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question