Currently on a project for work and im struggling a little with the Syntax, been workng with basic SQL for about a year now.
my problem is the code im writing looks untidy I am trying to tidy it up a bit.
i have two Variables one called @NCDLLV and one called @PAFTER
This is my current set of code
IF (@TRPREM > 1000 AND @NCDRP <> 'A')
Begin
IF @NCDRP = 'B' Set @NCDLLV = 10
IF @NCDRP = 'C' Set @NCDLLV = 20
IF @NCDRP = 'D' Set @NCDLLV = 30
IF @NCDRP = 'E' Set @NCDLLV = 40
End
IF @NCDRP = 'B' Set @PAFTER = @TRPREM * 0.9
IF @NCDRP = 'C' Set @PAFTER = @TRPREM * 0.8
IF @NCDRP = 'D' Set @PAFTER = @TRPREM * 0.7
IF @NCDRP = 'E' Set @PAFTER = @TRPREM * 0.6
however in practice at the moment my code runs two sets of IF's one setting the @NCDLLV and one setting @PAFTER.
i'm looking to condense this all into something a little shorter,
is there a way of doing this other than writing
IF @NCDRP = 'B'
Begin
Set @NCDLLV = 40
Set @PAFTER = @TRPREM * 0.9
END
Thank you for your time
Kind Regards,
Aucun commentaire:
Enregistrer un commentaire