Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Kleber
Yak Posting Veteran
67 Posts |
Posted - 2007-06-27 : 17:26:04
|
Hi,I have two users, one of them is db owner the other one is dataread only. The folowing query brings me the right answer when I load it with the db owner user. When I load it with dataread user it brings a wrong value on "saldo contabil atual" colunm. What could be possibly happening? I never saw something like that.RegardsKleber ----------------------------------------SELECT dbowner.t402cogc.cd_und as [Filial], dbowner.t402cogc.cd_ger as [Gerente], dbowner.t402cogc.cd_cli as [Codigo Cliente], dbowner.t402cofi.nm_pes as [Nome Cliente], dbowner.t402moda.cd_prd_ger as [Codigo Produto Gerencial], sum(dbowner.t402cogc.sd_dev_d0) as [Saldo Devedor], sum(dbowner.t402cogc.sd_atl_ctb_d0) as [Saldo Contabil Atual] FROM dbowner.t402cogc,dbowner.t402moda,dbowner.t402cofi,dbowner.t402prodWHERE (dbowner.t402cogc.sg_mod = dbowner.t402moda.sg_mod ) and (dbowner.t402cogc.cd_cli = dbowner.t402cofi.cd_cli ) and (dbowner.t402moda.sg_prd = dbowner.t402prod.sg_prd ) and (dbowner.t402cogc.cd_und = 4) and --<codigo da unidade selecionada na tela de entrada ) and (dbowner.t402cogc.cd_ger = 16) and --codigo do gerente selecionado na tela de entrada) and (dbowner.t402cogc.cd_cli = 202) and--<codigo do cliente capturado no primeiro select) and (dbowner.t402moda.id_tp_pes = 'J' ) and (dbowner.t402moda.id_nat_ctb = 'A') and (dbowner.t402prod.sg_car not in ('FNMA','BNDESA')) and (dbowner.t402cogc.dt_gp_ctb = '02-05-2007 0:0:0.000' ) and --Datavariavel D-1 (dbowner.t402cogc.sg_gp_ctb <> 'CONTRATO' ) and (dbowner.t402cogc.cd_emp = 1 ) and (dbowner.t402cogc.sd_dev_d0 > 0) GROUP BY dbowner.t402cogc.cd_und, dbowner.t402cogc.cd_ger, dbowner.t402cogc.cd_cli, dbowner.t402cofi.nm_pes, dbowner.t402moda.cd_prd_ger ORDER BY dbowner.t402cogc.cd_und, dbowner.t402cogc.cd_ger, dbowner.t402cogc.cd_cli, dbowner.t402cofi.nm_pes, dbowner.t402moda.cd_prd_ger |
|
Kleber
Yak Posting Veteran
67 Posts |
Posted - 2007-06-28 : 08:02:23
|
any Idea?? |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2007-06-28 : 12:47:50
|
can you simplfy the query and get both users to run it...at the exact same time?SELECT sum(dbowner.t402cogc.sd_atl_ctb_d0) as [Saldo Contabil Atual] FROM dbowner.t402cogcand then gradually add in the where clauses/joins...only thing I can can think of is that the data is changing between executions, or one is seeing uncommitted data and one isn't. |
|
|
|
|
|
|
|