Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's wrong with this view?

Status
Not open for further replies.

cehagema

Programmer
Oct 2, 2003
9
US
The following view belongs to sa and lives in a Db called DC. SELECT * FROM DC..COMP_TIME_LOST_V works fine for sa but
not for userx. userx has select access to the underlying tables and the view. userx also has access to the PROD and DC Dbs. In query Analyzer userx executes the above select and waits forever for results. If userx attempts to display the columns of the view using the object browser the +/- box disappears from the browser. Note also, that userx can execute the SELECT part of this create view statement just fine. Thanks for your help. Chris.

create view Comp_Time_Lost_V as
select j.home_department hd,
d.descr hdd,
j.home_department+' '+replace(d.descr,'-REG','') hddd,
w.empno emplid,
w.fname fname,
isnull(w.cmp_bal,0) prior_bal,
(isnull(w.ce15,0) + isnull(w.ce10,0)) earned,
isnull(w.cmp_hrs,0) taken,
isnull(w.cmp_bal,0) - isnull(w.cmp_hrs,0) +
isnull(w.ce15,0) + isnull(w.ce10,0) new_bal,
isnull(w.ce_lim,0) limit,
case
when isnull(w.ce_lim,0) - (isnull(w.cmp_bal,0) -
isnull(w.cmp_hrs,0) + (1.5*isnull(w.ce15,0)) + isnull(w.ce10,0)) < 0
then abs(isnull(w.ce_lim,0) - (isnull(w.cmp_bal,0) -
isnull(w.cmp_hrs,0) + (1.5*isnull(w.ce15,0)) + isnull(w.ce10,0)))
else 0
end lost
from dc..wsdata w,
prod..ps_job j,
prod..ps_al_dept_tbl d
where isnull(w.ce_lim,0) != 0
and j.emplid = w.empno
and d.department_nbr = j.home_department
and j.effdt = (select max(a.effdt)
from prod..ps_job a
where a.emplid = j.emplid)
and j.effseq = (select max(b.effseq)
from prod..ps_job b
where b.emplid = j.emplid
and b.effdt = j.effdt)


 
Does userx get results in the end?

The colums disapearing is to do with userx not having reading right on the systables in the database, set them up and your problems might be sloved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top