aspose file tools
The moose likes JDBC and Relational Databases and the fly likes How to set TIMEOUT in MSSQL? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How to set TIMEOUT in MSSQL?" Watch "How to set TIMEOUT in MSSQL?" New topic
Author

How to set TIMEOUT in MSSQL?

Ken Shamrock
Ranch Hand

Joined: Jan 23, 2002
Posts: 139
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


Thanks everyone who helped me
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to set TIMEOUT in MSSQL?