Hi again,

I'm trying to execute an FBSQLCommand, which includes an union clause, the 
sql runs fine from IBExpert but when I run the SQL in Visual Studio the 
provider throws the error : 335544569 (Dynamic SQL Error), I can only think 
that the provider doesn't have support for this kind of querys, that's not a 
big trouble at all, I can do a SP with the union inside which returns the 
data, but I just wanted to know what is causing this error. Below you will 
find the "problematic" sql ;-)

SELECT DISTINCT CENTROS.ID_CENTRO, CENTROS.DESCRIPCION
FROM CENTROS
  INNER JOIN USUARIO_ZONA ON (CENTROS.ID_CENTRO = USUARIO_ZONA.ID_CENTRO)
WHERE USUARIO_ZONA.ID_USUARIO = @ID_USUARIO AND
     NOT EXISTS (
     SELECT USUARIO_ZONA.ID_USUARIO
     FROM USUARIO_ZONA
      WHERE USUARIO_ZONA.ID_CENTRO=0 AND USUARIO_ZONA.ID_USUARIO = 
@ID_USUARIO)
UNION
SELECT DISTINCT CENTROS.ID_CENTRO, CENTROS.DESCRIPCION
FROM CENTROS
  INNER JOIN USUARIO_ZONA ON (CENTROS.ID_CENTRO = USUARIO_ZONA.ID_CENTRO)
WHERE EXISTS (
     SELECT USUARIO_ZONA.ID_USUARIO
     FROM USUARIO_ZONA
      WHERE USUARIO_ZONA.ID_CENTRO=0 AND USUARIO_ZONA.ID_USUARIO = 
@ID_USUARIO)

Also since the SQL is running fine outside, I don't know If I should be 
naming different each occurrence of @ID_USUARIO

Thanks,
Mocte 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to