Click here to Skip to main content
15,909,039 members

Comments by Member 7781963 (Top 35 by date)

Member 7781963 5-Apr-13 4:23am View    
Thanks for the answer. Can you please show me the DB Design? I am unable to understand your answer. Thanks.
Member 7781963 2-Jan-13 0:53am View    
How to do that? Kindly show me the code.
Member 7781963 30-Dec-12 18:29pm View    
i have added a new solution that i am trying now...is that a better solution than the earlier one...and yes i need the row numbers.
Member 7781963 30-Dec-12 18:26pm View    
Deleted
<pre lang="SQL">ALTER PROCEDURE [GetHomePageObjectPageWise]
@PageIndex INT = 1
,@PageSize INT = 10
,@PageCount INT OUTPUT
,@whereStoryID VARCHAR(2000)
,@whereAlbumID VARCHAR(2000)
,@wherePictureID VARCHAR(2000)
AS
BEGIN
SET NOCOUNT ON;

WITH Results1 AS
(
SELECT
StoryID,
AlbumID,
StoryTitle,
[AlbumName] = NULL,
[AlbumCover] =
(
SELECT URL
FROM AlbumPictures
WHERE (AlbumID = dbo.Stories.AlbumID) AND (AlbumCover = 'True')
),
Votes,
[PictureId] = NULL,
[tableName] = 'stories',
[Sort] = NEWID()
FROM Stories
WHERE
StoryID IN
(
SELECT StringVal
FROM funcListToTableInt(@whereStoryID)
)
)
, Results2 AS
(
SELECT
[StoryID] = NULL ,
AlbumID,
[StoryTitle] NULL,
AlbumName,
[AlbumCover] =
(
SELECT URL
FROM AlbumPictures AS AlbumPictures_3 --<<<do you="" need="" this="" alias?
="" where="" (albumid="Albums.AlbumID)" and="" (albumcover="True" )
="" ),
="" votes,
="" [pictureid]="NULL,
" [tablename]="albums" ,
="" [sort]="NEWID()
" from="" albums=""
="" albumid="" in="" (
="" select="" stringval="" funclisttotableint(@wherealbumid)
="" )="" ,="" result3="" as="" [storyid]="NULL," [albumid]="NULL,
" [storytitle]="NULL,
" [albumname]="NULL,
" url,
="" pictureid,
="" albumpictures="" --as="" albumpictures_1="" &lt;&lt;<do="" pictureid="" funclisttotableint(@wherepictureid)
="" result4="" *="" results1="" union="" all
="" results2="" results3
="" results="" as
="" [rownumber]="ROW_NUMBER()" over="" (order="" by="" desc),
="" x.*="" results4="" x
="" results
="" rownumber="" between(@pageindex="" -1)="" @pagesize="" +="" 1="" and(((@pageindex="" 1)="" @pagesize)="" -="" 1;
="" declare="" @recordcount="" int="@@RowCount;"

="" set="" @pagecount="CEILING(CAST(@RecordCount" decimal(10,="" 2))="" cast(@pagesize="" 2)));

end&lt;="" pre="">
Member 7781963 30-Dec-12 18:19pm View    
you mean remove #Results1,#Results2 and #Results3 ?