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 |
atwork8
Starting Member
3 Posts |
Posted - 2007-08-30 : 15:25:33
|
Hi there,I'm new to T-SQL and i'm trying to implement the efficient paging method outlined in scottgu's article: http://weblogs.asp.net/scottgu/archive/2006/01/07/434787.aspxThe problem is i'm trying to make the stored procedure Dynamic, but when I run the following Stored procedure I get the following error:Incorrect syntax near ')'.Invalid object name 'ItemEntries'.It looks like it is to do with the common table expression "ItemEntries". What would be the correct syntax for the following dynamic sql:SET @sqlString = 'With ItemEntries as (SELECT ROW_NUMBER() OVER (ORDER BY price ASC) as Row, dogIDFROM tblDogsWHERE ' + @whereClause + ')'EXEC(@sqlString)Any help would be very much appreciated, thanks  |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-08-30 : 15:37:10
|
Oh man. Without the complete code anything could be wrong.Have you tried to put a semicolon [geeen];[/green] before WITH keyword? E 12°55'05.25"N 56°04'39.16" |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-31 : 02:19:17
|
http://sqlteam.com/forums/topic.asp?TOPIC_ID=88705MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|