|
Posted by Eugene Anthony on 11/05/05 12:30
I have stored procedure:
create procedure sp_PagedTaxPerPlace
@Page int,
@RecsPerPage int
AS SET NOCOUNT ON
CREATE TABLE #TempItems
(
TaxPerPlaceID int IDENTITY,
CountryID int,
StateID int,
Zip int,
TaxPerPlace smallmoney,
ParentTaxPerPlaceID int
)
INSERT INTO #TempItems
(CountryID,StateID,Zip,TaxPerPlace,ParentTaxPerPlaceID) SELECT
CountryID,StateID,Zip,TaxPerPlace,TaxPerPlaceID FROM TaxPerPlace
Declare @FirstRecord int, @LastRecord int
Select @FirstRecord = (@Page - 1) * @RecsPerPage
Select @LastRecord = (@Page * @RecsPerPage + 1)
SELECT *,MoreRecords = (SELECT COUNT(*) FROM #TempItems TI WHERE
TI.TaxPerPlaceID >= @LastRecord) FROM #TempItems WHERE TaxPerPlaceID >
@FirstRecord AND TaxPerPlaceID < @LastRecord
SET NOCOUNT OFF
Return
GO
now before I insert into #TempItems as shown in my stored procedure, I
would like to replace for example:
CountryID = 1 to CountryID = Japan
StateID = 1 to StateID = Osaka
I have two tables. One table handles the country and the other table
handles the state and can be accessed using the following sql statement:
SELECT Name FROM Countries
SELECT Name FROM States
How do I solve the problem?. Your help is kindly appreciated.
Eugene Anthony
*** Sent via Developersdex http://www.developersdex.com ***
Navigation:
[Reply to this message]
|