All pastes #278621 Raw Edit

Something

public sql v1 · immutable
·published 2006-12-14 06:52 UTC
rendered paste body
Print 'Executing GetProperties'--This will return the maximum number of rows there are in the first datasetselect count(*) as TotalRecordsFound from property as SearchInfo;declare @lineage varchar(900)if @localeid <> 0begin	select @lineage = Lineage +'%' From Localetree where LocaleId = @localeidendelse	select @lineage = '%'SELECT *FROM   (   SELECT Property.EntityId as PropertyId,Property.[Name] as [Name],BookEmail,BookTelephone,		Property.Description,NTAPAccredited,ECOAccredited,		PropertyType.Name as PropertyTypeName,Commisionable,        ROW_NUMBER() OVER(ORDER BY PropertyType.<%OrderField%> ) as RowNum    FROM Property, PropertyType    Where    (Property.PropertyTypeId = PropertyType.PropertyTypeId)		AND		exists (Select PropertyId from product where product.propertyid = property.entityid)   )  as Property		AND	Property.LocaleId in 	 (		select LocaleId where Locale.Lineage like @lineage	 )WHERE RowNum > @startRowIndex AND  RowNum <= (@startRowIndex + @recordsPerPage)