Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rafeequddin_ahmed
Starting Member
23 Posts |
Posted - 2008-06-12 : 09:23:03
|
| HI,I am executing some statment as below in this.exec('with cart as (SELECT Row_number() over(order by '+@SortCondition +') as rowindex, c.ContentID,convert(varchar(100),c.ModifiedOn,101) as ModifiedOn, c.Name, UnitCost as SalePrice,c.Currency,isnull(DiscountedPrice,0) as DiscountedPrice, isnull(SubscriptionOnly,0) as SubscriptionOnly from tbl_Content c ' + @JoinCondition + ')' + ' select * from cart where rowindex between cast('+ @StartIndex + ' as int) and cast('+ @StartIndex + ' as int) + cast(' + @NoOfRecords + ' as int) ' + '-1 order by '+@SortCondition) ---------------------------------------------------------------in the above statment(which is part of SP) passing @SortCondition ,which may come as title,SalePrice,DatePublish from dotnet code.In the sp there are multiple statment depending upon some condition we are creating @JoinCondition.So in One case the Joining conidition will not have SalePrice as Origionl colum but derived column.I have to use the above statment and handle in Sale Price condition becuase in saleprice case it is alias column name.How can i do that.or the last statment I but in one more table if @SortCondition='salePrice asc/Sale price desc' with ordering.Plz help me out |
|
|
|
|
|
|
|