Hi :)Does anyone of you guru's :) know how to parse a variable from a stored procedure, this stored procedure creates a temp table which resides all the values i need ?What i need to do is parsing the value from a form text field, to the below sproc, in the select statement. ( WHERE Mobilnummer LIKE '%" & Rsearch & "%' )I've used the example, from 4 guys from rolla. with a small modification.CREATE PROCEDURE sp_PagedItems ( @Page int, @RecsPerPage int )AS-- http://www.4guysfromrolla.com/webtech/062899-1.shtml-- We don't want to return the # of rows inserted-- into our temporary table, so turn NOCOUNT ONSET NOCOUNT ON--Create a temporary tableCREATE TABLE #TempItems( ID int IDENTITY, Kontraktnummer varchar(50), Mobilnummer varchar(50), Opkaldstype varchar(255), Opkaldsmodtager varchar(255), Samtalestart datetime, Samtalevarighed varchar(50), Samtalepris varchar(50),)-- Insert the rows from tblItems into the temp. table-- -- INSERT INTO #TempItems (Kontraktnummer,Mobilnummer,Opkaldstype,Samtalestart,Samtalevarighed,Samtalepris)SELECT KontraktNummer,MobilNummer,Opkaldstype,Samtalestart,Samtalevarighed,Samtalepris FROM Usage WHERE Mobilnummer LIKE '%" & Rsearch & "%' ORDER BY Samtalestart DESC-- Find out the first and last record we wantDECLARE @FirstRec int, @LastRec intSELECT @FirstRec = (@Page - 1) * @RecsPerPageSELECT @LastRec = (@Page * @RecsPerPage + 1)-- Now, return the set of paged records, plus, an indiciation of we-- have more records or not!SELECT *, MoreRecords = ( SELECT COUNT(*) FROM #TempItems TI WHERE TI.ID >= @LastRec ) FROM #TempItemsWHERE ID > @FirstRec AND ID < @LastRec-- Turn NOCOUNT back OFFSET NOCOUNT OFFGO
Any help will be much appreciated !Best regardsTaz