Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TOP cannot be a parameter
Message
De
30/05/2007 15:25:51
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01229408
Message ID:
01229428
Vues:
9
I think the 2005 option may be my best choice or dynamic sql as you suggested. Actually my select statement is a compound union from the same underlying table - quite "messy"

Thanks

Glenn>1. Upgarde to SQL 2005 which support variables in TOP clause
>2. Use dynamic SQL query - EXECUTE, sp_excutesql
>3. Use SET ROWCOUNT PageSize
>
>>This code produces an error in QA due to the parameter for the TOP value.
>>
>>create procedure invpage
>>@SearchString VarChar(50),
>>@PageSize Integer,
>>@PageNo Integer
>>as
>>set @pagesize = 10
>>set @SearchString = 'Beer'
>>
>>SELECT top @PageSize inv.uid, inv.isbn13, inv.sku1, inv.description,
>inv.listprice, inv.webprice, inv.datepub, inv.edition, inv.pages, inv.oop,
>inv.binding, inv.idsect,
>>      Annotation.annotation, author.fullname, COVERART.JFILENAME, COVERART.TFILENAME, inv.uidclient
>>FROM inv LEFT OUTER JOIN
>>     Annotation ON inv.isbn13 = Annotation.isbn13 LEFT OUTER JOIN
>>     author ON inv.uidAuthor = author.uid LEFT OUTER JOIN
>>                         COVERART ON inv.isbn13 = COVERART.ISBN13
>>WHERE (inv.uidclient = 2) AND CONTAINS(inv.description, @SearchString)
>>
>>
>>Any Ideas?
>>
>>Glenn
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform