General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only