You are here: stored procedure « MsSQL Server « IT news, forums, messages
stored procedure

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация