Results 1 to 3 of 3
Thread: stored procedure count data type
Nov 27, 2001, 07:47 #1
- Join Date
- Jun 2001
- 0 Post(s)
- 0 Thread(s)
stored procedure count data type
attempting to retrieve the count of all topics in a table related to the main topic in the same table. Make sense?
This would work ,but when I attempt to retrieve the count and pass it to a integer variable it fails. How do I convert it? I have failed in my attempts.
declare @topic_count int, @count nvarchar(5)
set @topic_count = 0
if (@topic_parent <> -1)
select count(topic_id) as 'Count' from topics where topic_parent = @topic_parent
set @count = 'Count'
set @topic_count = convert(int, @count)
update topics set topic_count = 9 where topic_id = 20 and topic_parent = -1
INSERT INTO topics(forum_id, u_id, topic_name, topic_parent, topic_count, topic_message) VALUES (@forum_id, @u_id, @topic_name, @topic_parent, @topic_count, @topic_message)