Wednesday, November 19, 2008
 
  Forum  Products  BlogDisplay  SQL 2k Error
Previous Previous
 
Next Next
New Post 6/30/2008 9:40 AM
  timk
3 posts
No Ranking


SQL 2k Error 

It appears as though your module will only run under a SQL 9 (2k5) compliant database because of the use of "select top(@var)*" construct...  Those of us running sql2k or msde databases will get an error on installation because the use of a variable in the select top clause is not supported in sql2k. 

 
New Post 6/30/2008 12:04 PM
  timk
3 posts
No Ranking


Re: SQL 2k Error 
Modified By timk  on 7/1/2008 7:24:28 AM)

****sorry... the first script didn't account for paging.  The script below works with the paging.

Here is a revised script that will work for sql 2k implementations...  although, i did have to run it manually because there was an error getting thrown because something appears to have been taking out the + signs for the concatenation of the userfullname field...  However, once I ran this manually, the module seems to work well on sql 2k.

declare @rows int
set @rows = @MaxEntries * @CurrentPage

select U.[UserID],
U.[Username],
U.[FirstName] + ' ' + U.[LastName] AS UserFullName,
E.[EntryID] as ItemID,
E.[BlogID],
E.[Title],
E.[Description],
E.[Entry],
E.[AddedDate],
E.[Published],
E.[Copyright],
E.[PermaLink],
IsNull(E.[AllowComments],B.[AllowComments]) As AllowComments,
B.[ParentBlogID],
B.[AllowAnonymous],
B.[Syndicated] AS BlogSyndicated,
B.[Public] AS BlogPublic,
( Select Count(*)
FROM dbo.[Blog_Comments]
WHERE EntryID = E.EntryID
AND (Approved = 1)) As CommentCount,
ident = IDENTITY(int, 1, 1)
INTO #topentries
FROM dbo.[Blog_Blogs] B
INNER JOIN dbo.[Blog_Entries] E
ON B.[BlogID] = E.[BlogID]
INNER JOIN dbo.[Users] U
ON B.[UserID] = U.[UserID]
WHERE B.PortalID = @PortalID
AND (E.[Published] = 1)
AND (B.[Public] = 1)
ORDER BY E.AddedDate DESC

select *
from #topentries
where ident between (@rows - @MaxEntries + 1) and @rows

drop table #topentries

 
New Post 7/1/2008 11:13 PM
  Rip Rowan
34 posts
No Ranking


Re: SQL 2k Error 

Tim - thanks for the script.  We'll look into making BlogDisplay 2K compliant in the next version.

 
Previous Previous
 
Next Next
  Forum  Products  BlogDisplay  SQL 2k Error
Privacy Statement  |  Terms Of Use
Copyright 2008 Radiant Software Corporation. All Rights Reserved.