Sql 如何使用存储过程从调用标量值

Sql 如何使用存储过程从调用标量值,sql,stored-procedures,Sql,Stored Procedures,假设我有一个标量值函数,它以两个guid作为参数: 心脏分布 两个guid区域ModelId和区域id 该函数返回另一个Guid 有人能给我解释一下我是如何在存储过程中调用这个函数并将结果返回给变量的吗 我试着用: CarDistribution('a Guid in here', 'another Guid in here') 但是我得到了错误 “speciesareapresence\u eval\u internal”附近的“语法不正确” 谢谢 declare @NewGUID

假设我有一个标量值函数,它以两个guid作为参数:

心脏分布

两个guid区域ModelId和区域id

该函数返回另一个Guid

有人能给我解释一下我是如何在存储过程中调用这个函数并将结果返回给变量的吗

我试着用:

CarDistribution('a Guid in here', 'another Guid in here')
但是我得到了错误 “speciesareapresence\u eval\u internal”附近的“语法不正确”

谢谢

    declare @NewGUID uniqueidentifier    

    Select @NewGUID = dbo.CarDistribution (ModelId, AreaId)

    From dbo.YourTable