ITeye博客

Delete top n according to the variable

mssp · 2011-03-02 16:29 · C# · 数据库 · Markdown

declare @num int;
select @num=count(*) from budget where fk_project_id=62;

declare @topstr nVARCHAR(256);
set @topstr='select top'+str(@num) +' * from budget';

execute sp_executesql @topstr ;

 

declare @num int;
select @num=count(*) from budget where fk_project_id=62;

declare @topstr nVARCHAR(256);
set @topstr='select top'+str(@num) +' * from budget'; 

execute sp_executesql @topstr ;

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。