Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Ok here is my scalar UDF
CREATE FUNCTION fn_getjudge(@module char(10), @keyident nvarchar (12))
RETURNS char(3)
begin
DECLARE @judgecode Char(3)
SET @judgecode=''
if @module='MV'
SELECT @judgecode= mv_judge FROM motorvehicle
WHERE keyident = @keyident
RETURN (@judgecode)
if @module='LL'
SELECT @judgecode= ll_judge FROM locallaw
WHERE keyident = @keyident
RETURN (@judgecode)
if @module='CV'
SELECT @judgecode=civ_judge FROM civil
WHERE keyident = @keyident
RETURN (@judgecode)
if @module='CRM'
SELECT @judgecode=crm_judge FROM criminal
WHERE keyident = @keyident
RETURN (@judgecode)
if @module='SC'
SELECT @judgecode=sc_judge FROM smallclaims
WHERE keyident = @keyident
RETURN (@judgecode)
end
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement