---------------------------------------------------------- /** CREATE FUNCTION fn_GetRobotCode2 () RETURNS varchar(20) AS BEGIN return 'aaa' END GO */ ---------------------------------------------------------- declare @aa varchar(20) set @aa = dbo.fn_GetRobotCode2() print @aa ----------------------------------------------------------