|
Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
Last post 02-05-2008, 1:33 PM by Alex. 10 replies.
-
01-31-2008, 11:16 AM |
-
Alex
-
-
-
Joined on 10-25-2006
-
Bucuresti
-
sysadmin
-
-
|
Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
Salut, la rularea urmatorului select primesc eroarea din Subject....aveti idee de ce?.....cum pot s-o evit (cu siguranta esle legata de conditia din where unde functie = functie (--and dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) =dbo.GetGrupareByIDTipMatricola(p.id_tipmatr,p.id_matr)) )......daca o scot intoarce ceva dar nu datele pe care mi le doresc
declare @dataCurenta smalldatetime, @idprim uniqueidentifier, @filtru_tip_persoana tinyint,
set @dataCurenta = getdate() set @idprim = 'B9F77393-F3EA-46C5-BA15-FB70C6199A20' set @filtru_tip_persoana = 1
IF @filtru_tip_persoana = 1 begin select dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) as grup, dbf.an, coalesce( (select sum(suma)from gotax.dbo.debite_pf p where p.id_tipdebit = 2 and p.an = dbf.an and dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) = dbo.GetGrupareByIDTipMatricola(p.id_tipmatr,p.id_matr) ),0) as ramasite, coalesce( (select sum(suma)from gotax.dbo.debite_pf p where (p.id_tipdebit = 5 or p.id_tipdebit = 8) and p.an = dbf.an and dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) = dbo.GetGrupareByIDTipMatricola(p.id_tipmatr,p.id_matr) ),0) as accesorii from gotax.dbo.roluri_fiz r inner join gotax.dbo.debite_pf dbf on r.id = dbf.id_rol where r.id_prim = @idprim and dbf.id_tipdebit in (2,5,8) and dbf.an <= year(@dataCurenta) group by dbf.an,dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) end
functia este:
CREATE FUNCTION GetGrupareByIDTipMatricola (@id_tipmatr tinyint,@id_matr uniqueidentifier) RETURNS varchar(100) AS BEGIN declare @aux varchar(100) if @id_tipmatr = 1 SET @Aux = (select label from gotax.dbo.tip_matricole where id = 1)
if @id_tipmatr = 2 begin SET @Aux =(select label from gotax.dbo.tip_matricole where id = 2)
end if @id_tipmatr = 3 SET @Aux = (select label from gotax.dbo.tip_matricole where id = 3)
if @id_tipmatr = 4 SET @Aux = (select denumire from gotax.dbo.tip_alte_taxe where id = coalesce( (select id_tipalte from gotax.dbo.matricole_alte_pf where id = @id_matr), (select id_tipalte from gotax.dbo.matricole_alte_pj where id = @id_matr) ) ) return @aux END
multumesc mult.
alex.
|
|
-
01-31-2008, 11:47 AM |
-
Diana
-
-
-
Joined on 03-21-2006
-
-
sysadmin
-
-
|
Re: Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
Esti "la zi" cu service pack-urile?
|
|
-
01-31-2008, 12:05 PM |
-
Alex
-
-
-
Joined on 10-25-2006
-
Bucuresti
-
sysadmin
-
-
|
Re: Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
da am verificat.......am SP4.......care cica ar rezolva problema....sau cel putin ar intoarce alta eroare
alex.
|
|
-
01-31-2008, 12:40 PM |
-
rsocol
-
-
-
Joined on 10-03-2006
-
Bucuresti
-
sysadmin
-
-
|
Re: Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
Problema este descrisă în KB 883415, iar hotfix-ul aferent este inclus într-adevăr în SP4, însă KB-ul menţionat precizează: "To resolve this problem, you must install this hotfix and turn on
trace flag 9056. You can turn on trace flag 9056 by adding -T9056 to the SQL Server command line or by using DBCC TRACEON(9056, -1)
from a query connection." Am sesizat această problemă mai demult, fiind discutată în acest thread. Este ciudat faptul că trebuie să activezi un trace flag pentru a evita un bug, însă mai sunt şi alte hotfix-uri (incluse în SP4) în aceeaşi situaţie. Am scris despre ele aici. Răzvan
|
|
-
01-31-2008, 1:31 PM |
-
Alex
-
-
-
Joined on 10-25-2006
-
Bucuresti
-
sysadmin
-
-
|
Re: Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
am rulat
DBCC TRACEON(9056, -1)
dar primesc aceeasi eroare
daca nu pot rezolva astfel problema cum as putea modifica scriptul pt. e evita folosirea conditiei
and (dbo.GetGrupareByIDTipMatricola (dbf.id_tipmatr,dbf.id_matr) = dbo.GetGrupareByIDTipMatricola (p.id_tipmatr,p.id_matr))
multumesc.
alex.
p.s. imi cer scuze dar am omis sa zic ca este corba de sql server 2000
|
|
-
01-31-2008, 2:27 PM |
-
rsocol
-
-
-
Joined on 10-03-2006
-
Bucuresti
-
sysadmin
-
-
|
Re: Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
Sorry, m-am grăbit şi nu am citit suficient de atent problema. KB-ul pe care l-am menţionat are alte simptome (rezultate incorecte), iar circumstanţele sunt doar vag asemănătoare. Problema ta este cea descrisă în KB 274729, însă pentru aceasta nu există hotfix, ci doar un workaround: să foloseşti DISTINCT (imediat după primul select) în loc de GROUP BY-ul de la sfârşit. Răzvan
|
|
-
01-31-2008, 2:49 PM |
-
Alex
-
-
-
Joined on 10-25-2006
-
Bucuresti
-
sysadmin
-
-
|
Re: Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
nu merge
problema e ca in selecturile cu coalesce, ca acesta (sunt 2 la numar unul as ramasite altul as accesorii):
coalesce( (select sum(suma) from gotax.dbo.debite_pf p where p.id_tipdebit = 2 and p.an = dbf.an and dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) = dbo.GetGrupareByIDTipMatricola(p.id_tipmatr,p.id_matr) ) ,0) as ramasite
folosesc dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) unde aliasul dbf este din from-ul primului select....selectul mare....dar nu stiu cum sa fac altfel
multumesc.
alex.
|
|
-
01-31-2008, 2:59 PM |
-
rsocol
-
-
-
Joined on 10-03-2006
-
Bucuresti
-
sysadmin
-
-
|
Re: Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
La mine a mers. Adică am reuşit să reproduc fenomenul, obţinând eroarea respectivă folosind query-ul tău şi următoarele tabele:
create table debite_pf ( id_tipdebit int, suma money, id_matr uniqueidentifier, id_tipmatr int, id_rol int, an int )
create table roluri_fiz ( id int, id_prim uniqueidentifier )
Iar apoi am încercat următorul query, care nu a mai dat eroare:
select distinct dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) as grup, dbf.an, coalesce( (select sum(suma)from debite_pf p where p.id_tipdebit = 2 and p.an = dbf.an and dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) = dbo.GetGrupareByIDTipMatricola(p.id_tipmatr,p.id_matr) ),0) as ramasite, coalesce( (select sum(suma)from debite_pf p where (p.id_tipdebit = 5 or p.id_tipdebit = 8) and p.an = dbf.an and dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) = dbo.GetGrupareByIDTipMatricola(p.id_tipmatr,p.id_matr) ),0) as accesorii from roluri_fiz r inner join debite_pf dbf on r.id = dbf.id_rol where r.id_prim = @idprim and dbf.id_tipdebit in (2,5,8) and dbf.an <= year(@dataCurenta)
Răzvan
|
|
-
01-31-2008, 3:13 PM |
-
Alex
-
-
-
Joined on 10-25-2006
-
Bucuresti
-
sysadmin
-
-
|
Re: Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
ai dreptate merge...multumesc mult (nu stiu cum am testat eu de primeam aceeasi eroare....imi cer scuze)
singura problema este ca dureaza f mult......2 min....si chiar nu e din cauza ca ar fi f multe date.....
alex.
|
|
-
01-31-2008, 3:35 PM |
-
Alex
-
-
-
Joined on 10-25-2006
-
Bucuresti
-
sysadmin
-
-
|
Re: Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
daca ii scot conditia ----and dbf.an <= year(@dataCurenta)
atunci e ok....<2 sec
alex.
|
|
-
02-05-2008, 1:33 PM |
-
Alex
-
-
-
Joined on 10-25-2006
-
Bucuresti
-
sysadmin
-
-
|
Re: Internal SQL Server error. (Server: Msg 8624, Level 16, State 21, Line 29)
exista vreo varianta sa inlocuiesc conditia
and dbo.GetGrupareByIDTipMatricola(dbf.id_tipmatr,dbf.id_matr) = dbo.GetGrupareByIDTipMatricola(p.id_tipmatr,p.id_matr)
dureaza f mult daca rulez procedura pt mai mult de 100 persoane....si cred ca e din cauza acestei conditii....
sau sa simplific cumva functia......daca e posibil
multumesc mult.
alex.
|
|
|
|
|