469,921 Members | 2,183 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,921 developers. It's quick & easy.

how to read the query in store procedure

i wrote a stored procedure here is the code


CREATE Procedure dm_deleteBBPost
(
@TopicID numeric,
@ForumID numeric

)
As
declare @netCount as int

BEGIN
Select @netCount=count(*) from tablename where TopicID=@TopicID

update tablename set TotalTopics=TotalTopics-1,TotalPosts=TotalPosts-@netCount where ForumID=@ForumID

Delete From tblBBPosts Where TopicID = @TopicID
Delete From tblBBTopics Where TopicID =@TopicID

end
declare @pr_ForumsToday as varchar

////////// select Top 1 * from tablename order by column name desc
GO



IN that last line one row will be displayed. how can i read one of the field from the query (selct top1 etc)
Jul 19 '07 #1
1 886
vijaii
15
i wrote a stored procedure here is the code


CREATE Procedure dm_deleteBBPost
(
@TopicID numeric,
@ForumID numeric

)
As
declare @netCount as int

BEGIN
Select @netCount=count(*) from tablename where TopicID=@TopicID

update tablename set TotalTopics=TotalTopics-1,TotalPosts=TotalPosts-@netCount where ForumID=@ForumID

Delete From tblBBPosts Where TopicID = @TopicID
Delete From tblBBTopics Where TopicID =@TopicID

end
declare @pr_ForumsToday as varchar

////////// select Top 1 * from tablename order by column name desc
GO

IN that last line one row will be displayed. how can i read one of the field from the query (selct top1 etc)
Try this...

SELECT TOP 1 COLUMNNAME FROM TABLENAME ORDER BY COLUMN NAME DESC
Jul 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by TARUN | last post: by
10 posts views Thread by Daniel | last post: by
3 posts views Thread by =?Utf-8?B?ZGF2aWQ=?= | last post: by
6 posts views Thread by Phil Stanton | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.