把你的SQL server 的 TIMEOUT调大一点!
解决方案 »
- sql server2000《查询分析器》最多可以执行多少行sql语句?
- m_pConnection.CreateInstance(_uuidof(Connection)),返回2147221164
- SQL Server数据库查询优化的常用方法总结
- 怎样能把某个数据库中的表名及其所有者抽出来
- 安装SQL2000的问题?急救。。。。
- 怎样取出ID字符串放到查询语句中?
- 求助 触发器日志的具体写法和案例
- 管理 MSDE 数据库用什么工具最好 ?
- 有这样一道Sql题目
- 在SqlServer的存储过程中,如何判断传进来的字符串参数是诸如"12:12:00"的时间格式。
- ms-sql和access有没有流水号这个东西?
- 关于SQL SERVER内存占用问题解决问题者100送上
sqlserver客户端-->开始菜单-->SQLserver-->客户端网络实用工具-->别名-->添加-->写入别名如"大力"-->"网络库"选tcp/ip-->服务器名称写入远程ip或实例名-->OK了2、换宽带
為什麼原來可以,現在就會出現這個問題!!!!
急死人了,報表出不了!!!
不管有沒有用,我還是把SQL語句貼上來吧!這麼長的語句我不知從那裡優化了!
select distinct rtrim(a.cust_no) as cust_no, CASE WHEN c.cust_ename<>'' THEN c.cust_ename WHEN c.cust_name<>'' THEN c.cust_name ELSE '( 沒 有 記 錄 )' END AS cust_name, a.doc_no, a.txn_date, g.due_date, a.exch_rate, a.amount, b.cr_amt, d.db_amt, e.oc_amt, f.pay_amt as pay_amt from (( (ar a left outer join (select cust_no, inv_no, sum(cr_amt) as cr_amt from arcr where cr_no in (select doc_no from ar where txn_date < '2003/5/01' and R_P='R' and txn_type='C') group by inv_no, cust_no) as b on a.doc_no=b.inv_no) left outer join (select cust_no, inv_no, sum(db_amt) as db_amt from ardb where db_no in (select doc_no from ar where txn_date < '2003/5/01' and R_P='R' and txn_type='D') group by inv_no, cust_no) as d on a.doc_no=d.inv_no) left outer join (select cust_no, inv_no, sum(oc_amt) as oc_amt from aroc where ref_no in (select doc_no from ar where txn_date < '2003/5/01' and R_P='R' and txn_type='O') group by inv_no, cust_no) as e on a.doc_no=e.inv_no) left outer join (select cust_no, inv_no, sum(pay_amt) as pay_amt from arpay where chq_no in (select doc_no from ar where txn_date < '2003/5/01' and R_P='R' and txn_type='P') group by inv_no, cust_no) as f on a.doc_no=f.inv_no, customer c, arinv g where a.R_P='R' and (a.txn_type='I' or a.txn_type='A') and a.cust_no=c.cust_no and c.factoring=1 and c.cust_no between '80100' and 'TFPCL' and c.currency = 'HKD' and a.txn_date < '2003/5/01' and g.inv_no=a.doc_no order by a.cust_no, g.due_date, a.doc_no
補充一句,別的報表的SQL也很長,但是不會出現這個錯誤。
...
...這樣執行起來會不會快一些?
但是在group by 時總是出錯(group by cust_no),各位高手指點怎麼改寫?
分不夠可再加!!!!!