• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set TIMEOUT in MSSQL?

 
Ken Shamrock
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I execute this SQL in MSSQL and prompt me a timeout box, i wonder how i can set the MSSQL's query timeout?
SQL:
SELECT c.theme_title, c.grade_id, b.sub_theme_title, count(a.cd)
FROM hit_rates_report_log a, sub_theme b, theme c
WHERE a.type = 'SUBTHEME' AND a.cd = b.sub_theme_cd AND
b.theme_cd = c.theme_cd AND (access_time >= '2003-6-15 00:00:00') AND
(access_time <= '2003-7-15 23:59:59') AND b.theme_cd IN
(SELECT theme_cd
FROM theme_lang_link
WHERE lang_cd = 'CHI')
GROUP BY c.theme_title, c.grade_id, b.sub_theme_title, a.cd
UNION
SELECT e.theme_title, e.grade_id, d .sub_theme_title, 0
FROM sub_theme d, theme e
WHERE NOT EXISTS
(SELECT 'X'
FROM hit_rates_report_log f
WHERE f.type = 'SUBTHEME' AND f.cd = d .sub_theme_cd AND
e.theme_cd = d .theme_cd AND (access_time >= '2003-6-15 00:00:00') AND
(access_time <= '2003-7-15 23:59:59') AND d .theme_cd IN
(SELECT theme_cd
FROM theme_lang_link
WHERE lang_cd = 'CHI'))
ORDER BY c.theme_title, b.sub_theme_title

If I break the union and query the 2 SQL one by one,no timeout, ie
SQL1:
SELECT c.theme_title, c.grade_id, b.sub_theme_title, count(a.cd)
FROM hit_rates_report_log a, sub_theme b, theme c
WHERE a.type = 'SUBTHEME' AND a.cd = b.sub_theme_cd AND
b.theme_cd = c.theme_cd AND (access_time >= '2003-6-15 00:00:00') AND
(access_time <= '2003-7-15 23:59:59') AND b.theme_cd IN
(SELECT theme_cd
FROM theme_lang_link
WHERE lang_cd = 'CHI')
GROUP BY c.theme_title, c.grade_id, b.sub_theme_title, a.cd
SQL2:
SELECT e.theme_title, e.grade_id, d .sub_theme_title, 0
FROM sub_theme d, theme e
WHERE NOT EXISTS
(SELECT 'X'
FROM hit_rates_report_log f
WHERE f.type = 'SUBTHEME' AND f.cd = d .sub_theme_cd AND
e.theme_cd = d .theme_cd AND (access_time >= '2003-6-15 00:00:00') AND
(access_time <= '2003-7-15 23:59:59') AND d .theme_cd IN
(SELECT theme_cd
FROM theme_lang_link
WHERE lang_cd = 'CHI'))
ORDER BY c.theme_title, b.sub_theme_title
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic