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',
SELECT  * FROM OPENQUERY(localhost,'exec sp_who')

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

Scrolling GridView - Retain Scroll Position on Postback

The cleanest example I have seen for this feature is by Sergey Akopov.

Sergey implement a jQuery example that works wonderfully! Here is the link to the article. I attached the ZIP file same code, which is on Sergey's site as well. (3.01 kb)

Here is a link to a pure JavaScript example (older 2006). I have not tried it out but wanted to save the link as another example.

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.