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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamic SQL in stored procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-09-12 : 08:04:39
Tarun Sharma writes "How can i check that the dynamic query has fetch the records??
will it work??????
declare @sql varchar
@sql="...."
if exists(exec(@sql))
begin
......
end"

SamC
White Water Yakist

3467 Posts

Posted - 2003-09-12 : 08:14:13
All you need is

IF @@ROWCOUNT > 0 BEGIN

There's also an @@ROWCOUNT that is scoped for the procedure. What was that ?

Sam
Go to Top of Page
   

- Advertisement -