SQL query on Topic name help

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/63098?pagenum=1
05 November 2025, 05:22

Topic


StephenD
SQL query on Topic name help
25 October 2006, 06:07


I've got a relatively small sized db now with 3850 topics. The topic name is unique in that I append a case no. to the end of the topic name that looks like: 4356/2006 or 4357/2006.
What I am trying to do is when posting a new topic (case) I query the db and display in post.asp the next available case no based on the highest number in the first part of that case no. + 1 so in the above example 4358/2006 will be the next suggested case no.
Then again I suppose I could create a new table with autonumber starting at last case no. linked to topic_id that I would insert a record into same time the topic gets posted, then upate forum_topics T_SUBJECT with the appended case no.
SELECT T_SUBJECT INTO FORUM_TEMPXX FROM FORUM_TOPICS WHERE RIGHT(T_SUBJECT,1)='6'
UPDATE FORUM_TEMPXX SET T_SUBJECT = RIGHT(T_SUBJECT,9)
UPDATE FORUM_TEMPXX SET T_SUBJECT = LEFT(T_SUBJECT,4)<

 

Replies ...


HuwR
25 October 2006, 06:23


Then again I suppose I could create a new table with autonumber starting at last case no. linked to topic_id that I would insert a record into same time the topic gets posted, then upate forum_topics T_SUBJECT with the appended case no.
This would be the prefered way to do it, rather than parsing the text of the subject in your query.<
© 2000-2021 Snitz™ Communications