SQL 求教(200分)

  • 主题发起人 mingming_wang
  • 开始时间
M

mingming_wang

Unregistered / Unconfirmed
GUEST, unregistred user!
用Delphi编一数据库程序,访问局域网中的NT服务器。
数据库是MS SQL SERVER 6.5
当用如下语句查询时,总有错误:General SQL error
select empid,name,sex,
nation,cityid,idcard,birthday,
politcaption,marrystu,eye,height,
weight,pcskillcaption,titlecaption,
educaption,degreecaption,specaption,
waycert,license,lang1_name,lang1_level,
foreignlang,gradate,jobdate,edudetail,
jobdetail,goodat,linkman,telephone,
addr,zipcode,jobspec,jobstyle,
jobway,jobpay,jobarea,ldxs,otherapply
from employee a,
politcode b,
pcskillcode c,
titlecode d,
educode e,
degreecode f,
specode g
where a.empid="0000000001"
and a.politid=b.politid
and a.pcskillid=c.pcskillid
and a.titleid=d.titleid
and a.eduid=e.eduid
and a.degreeid=f.degreeid
and a.specid=g.specid

当去掉任意三个查询条件便没错,
不知为何,该如何解决,请各位大狭帮忙。
 
请在 select 后面的每个字段前加上 别名试试看。
e.g. select a.empid, a.name, a.sex, ... b.nation, ..., c.XXX ...
 
既然是非动态SQL,可以拿到SQLServer的ISQLW里去
直接执行一下,看看SQLServer返回的是什么错误,再进行分析。
 
字段加上别名还是不行,
ISQLW返回的错误如下:
This command did not return data, and it did not return any rows

DB-Library Process Dead - Connection Broken

另:specode表比较大,去掉specaption字段也可查询到。
 
我遇到过这种情况,还是溢出。
只要把字段分成两部分,生成两个视图,
然后把两个视图再生成一个视图便可。
 

Similar threads

顶部