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 |
|
jogin malathi
Posting Yak Master
117 Posts |
Posted - 2007-05-29 : 01:43:52
|
| hiin stored procedures i don't want to display message as these many rows eg: (1 row(s) returned)for that i wrote SET NOCOUNT ON but also it displaysis their any ather solutionor else iam going in wrong wayMalathi Rao |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-05-29 : 01:44:59
|
| Can you post the SP code?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
jogin malathi
Posting Yak Master
117 Posts |
Posted - 2007-05-29 : 01:45:47
|
quote: Originally posted by harsh_athalye Can you post the SP code?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
ALTER PROCEDURE usp_r_select_requirement @req_id varchar(50),@search varchar(50),@sname varchar(50),@stat int,@operator char(1)AS SET NOCOUNT ON if (@operator='F') begin --SELECT * FROM Requirement ------select statement to display data into grid when id given if(@req_id!='') AND (@search='') AND (@sname='') begin Select r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock) JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Id where r.Requirement_Id=@req_id end ------select statement to display data into grid when id,fdate,todate are given ELSE IF(@req_id!='')AND (@search!='') AND (@sname!='') BEGIN Select r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock) JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Id where r.Requirement_Id=@req_id and r.Requirement_Date Between @search and @sname and r.Status=@stat END ------select statement to display data into grid when id,fdate,todate are given ELSE IF(@req_id!='')AND (@search!='') AND (@sname='') BEGIN Select r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock) JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Id where r.Requirement_Id=@req_id and r.Requirement_Date >= @search and r.Status=@stat END ------select statement to display data into grid when fdate,todate are given Else if(@search!='') AND (@sname!='') begin Select r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock) JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Id where r.Requirement_Date Between @search and @sname and r.Status=@stat end ------select statement to display data into grid when fdate,todate are given Else if(@search!='') AND (@sname='') begin Select r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock) JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Id where r.Requirement_Date >= @search and r.Status=@stat end else ------select statement to display data into grid when form loads begin Select r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock) JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Id where r.Status=@stat end endMalathi Rao |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-05-29 : 01:47:24
|
SET NOCOUNT ON will turn off the display message. (1 row(s) returned) will be suppressed. Where do you include this line in your stored procedure ? Can you post your code here ? KH |
 |
|
|
jogin malathi
Posting Yak Master
117 Posts |
Posted - 2007-05-29 : 01:49:43
|
quote: Originally posted by khtan SET NOCOUNT ON will turn off the display message. (1 row(s) returned) will be suppressed. Where do you include this line in your stored procedure ? Can you post your code here ? KH
ALTER PROCEDURE usp_r_select_requirement@req_id varchar(50),@search varchar(50),@sname varchar(50),@stat int,@operator char(1)ASSET NOCOUNT ON if (@operator='F')begin--SELECT * FROM Requirement------select statement to display data into grid when id givenif(@req_id!='') AND (@search='') AND (@sname='')beginSelect r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock)JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Idwhere r.Requirement_Id=@req_id end------select statement to display data into grid when id,fdate,todate are givenELSE IF(@req_id!='')AND (@search!='') AND (@sname!='')BEGINSelect r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock)JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Idwhere r.Requirement_Id=@req_id and r.Requirement_Date Between @search and @sname and r.Status=@statEND------select statement to display data into grid when id,fdate,todate are givenELSE IF(@req_id!='')AND (@search!='') AND (@sname='')BEGINSelect r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock)JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Idwhere r.Requirement_Id=@req_id and r.Requirement_Date >= @search and r.Status=@statEND------select statement to display data into grid when fdate,todate are givenElse if(@search!='') AND (@sname!='')beginSelect r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock)JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Idwhere r.Requirement_Date Between @search and @sname and r.Status=@statend------select statement to display data into grid when fdate,todate are givenElse if(@search!='') AND (@sname='')beginSelect r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock)JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Idwhere r.Requirement_Date >= @search and r.Status=@statendelse ------select statement to display data into grid when form loads beginSelect r.Id,r.Requirement_Id,r.Source_Id,s.Sname,r.Type,r.Requirement_Date,r.Environment,r.Status from Rpo.dbo.Requirement r (nolock)JOIN Rpo.dbo.Source s (nolock) on s.Source_Id=r.Source_Idwhere r.Status=@statend endMalathi Rao |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-05-29 : 01:59:50
|
| I can't see how you are getting the message. Are you sure this is the SP which is at fault?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
jogin malathi
Posting Yak Master
117 Posts |
Posted - 2007-05-29 : 02:02:13
|
quote: Originally posted by harsh_athalye I can't see how you are getting the message. Are you sure this is the SP which is at fault?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
i got o/p asId Requirement_Id Source_Id Sname Type Requirement_Date Environment Status ----------- -------------------------------------------------- ----------- -------------------------------------------------- -------------------------------------------------- ----------------------- -------------------------------------------------- ----------- 2 REQ2 4 MICROSOFT Internal 4/30/2007 shsd 1 No rows affected.(1 row(s) returned)Malathi Rao |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-05-29 : 02:05:50
|
try to apply your stored procedure again. Your SP looks fine to me KH |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-05-29 : 02:09:07
|
| use sp_recompile to compile your SP again and try running it.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
jogin malathi
Posting Yak Master
117 Posts |
Posted - 2007-05-29 : 02:10:33
|
quote: Originally posted by khtan try to apply your stored procedure again. Your SP looks fine to me KH
ya iam getting the countMalathi Rao |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-05-29 : 22:48:46
|
How do you execute the Stored Procedure ? KH |
 |
|
|
|
|
|
|
|