• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to set TIMEOUT in MSSQL?

 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I carry this gun in case a vending machine doesn't give me my fritos. This gun and this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic