Terima kasih @twoleggedhorse.
Inilah solusinya.
-
Pertama kita buat fungsi
CREATE FUNCTION GetAIntFromStoredProc(@parm Nvarchar(50)) RETURNS INTEGER AS BEGIN DECLARE @id INTEGER set @id= (select TOP(1) id From tbl where [email protected]) RETURN @id END
-
lalu kita lakukan kueri pemilihan
Select col1, col2, col3, GetAIntFromStoredProc(T.col1) As col4 From Tbl as T Where [email protected]