Call SQL Server Procedure in a Select Statement

I have a procedure that returns data that is used to populate a grid. I wanted to use the same procedure to pull out x number of rows from another procedure. I thought if I could call a the stored procedure on a cursor vs. using a select statement I could reuse the procedure.  

I came across an article that covered OPENQUERY. Basically you create a linked server on the same database you want to access. Then in this way you can call a SQL Server Stored Procedure in a select statement and use it as part of a cursor!

--1. Allow Data Access to this SQL Instance
exec sp_serveroption @server = 'YOURSERVERNAME\YOURINSTANCE' 
                    ,@optname = 'DATA ACCESS' 
                    ,@optvalue = 'TRUE' 


--2. Use navtive OLEDB provider. server name set as localhost. Could be anything
EXEC master.dbo.sp_addlinkedserver @server = N'localhost',
                                   @srvproduct=N'',
                                   @provider=N'SQLNCLI',
                                   @datasrc=N'YOURSERVERNAME\YOURINSTANCE'
      
SELECT  * FROM OPENQUERY(localhost,'exec sp_who')
--http://msdn.microsoft.com/en-us/library/ms190479.aspx

On one SQL Server 2008 the query executes fine, on another I had to include the following:

SELECT  * FROM OPENQUERY(localhost,'SET FMTONLY OFF; SET NOCOUNT ON;exec MyDB.dbo.prc_get_some_data')

Reference this post on StackOverflow

U9GT 2 Cube Android Tablet Review

I own an ACER Android tablet. I was looking for a tablet with a size for magazine reading than a 10.1 wide screen like the ACER.

I bought a new U9GT 2 Cube Android tablet from China,  I would recommend you do not buy one.  I put in a claim at AliExpress and did not release my funds to the vendor.

Issues with the U9GT 2 Tablet:

  • Low quality build
  • Touch screen has a very slow response
  • The construction is basically a glue together screen and case. The unit I have the screen is coming apart from the case
  • Good things about the U9GT Tablet: Nothing.

Conclusion: Spend $400 or more and buy an ACER, ASUS, Samsng, Sony, or XOOM. You will pay maybe double the price of the U9GT but it will be worth it. After using the U9GT junk tablet my ACER A500 elevated to a higher level then I thought previously.