日期:2014-05-18 浏览次数:20516 次
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= CREATE PROCEDURE Bolg_SelectByUser @clanID int, @UserID text, @topNum int AS BEGIN EXECUTE Clan_SelectByIDUserID @ClanID,@UserID OUTPUT select top @topNum * from GH_BLog where UserID in (@UserID) order by LastModTime desc END GO
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= CREATE PROCEDURE Bolg_SelectByUser @clanID int, @UserID text, @topNum int AS BEGIN Declare @SqlStr varchar(max) EXECUTE Clan_SelectByIDUserID @ClanID,@UserID OUTPUT Set @SqlStr = 'select top ' + Cast(@topNum As Varchar(10)) + ' * from GH_BLog where UserID in (' + @UserID + ') order by LastModTime desc ' Exec(@SqlStr) END GO
------解决方案--------------------
就是把报错的那句改成动态sql 执行应该就没问题了