on 2010 Dec 20 10:05 AM
query on UDF
IF $[OIGE.Series.Number]= 65
begin
Select OIGN.U_BP_Name From OIGN where DocNum =$[OIGE.U_JW_NO]
End
If $[OIGE.Series]= 64
Begin
select CardName from OCRD
END
If $[OIGE.Series]= 17
Begin
select CardName from OCRD
END
when i m executing this query it generate this error :
Error. [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near
the keyword 'FOR'. 2). [Microsoft][SQL Native Client][SQL
Server]Statement '' (NFN1) (s) could not be prepared.
Try this:
SELECT CASE
WHEN $[OIGE.Series] = 65 THEN (Select OIGN.U_BP_Name From OIGN where DocNum =$[OIGE.U_JW_NO])
WHEN $[OIGE.Series] IN (64, 17) THEN (Select T0.CardName from OCRD T0 WHERE T0.CardCode=$[OIGE.CardCode]
END
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this one:
SELECT CASE
WHEN $[OIGE.Series] = 65 THEN (Select OIGN.U_BP_Name From OIGN where DocNum =$[OIGE.U_JW_NO])
WHEN $[OIGE.Series] = 64 THEN (Select T0.CardName from OCRD T0)
WHEN $[OIGE.Series] = 17 THEN (Select T0.CardName from OCRD T0)
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
102 | |
8 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.