我试图获取我的函数给出的值并将其保存到变量中,以便检查它不是='0'。经过广泛的搜索后,我无法找到一种有效的方法。它甚至可能吗?
DECLARE @InspectionID AS VARCHAR(10)
SELECT
SYEL.UserComments AS 'UserComments',
SET @InspectionID = [Silco_Final].[dbo].[GetInspectionIDFromUserComments](SYEL.UserComments)
FROM SY_Edit_Log SYEL
WHERE SYEL.UserCode = 'broberts'
AND @InspectionID <> '0'
答案 0 :(得分:3)
你能否直接在where子句中调用该函数?
SELECT
SYEL.UserComments AS 'UserComments',
FROM SY_Edit_Log SYEL
WHERE SYEL.UserCode = 'broberts'
AND [Silco_Final].[dbo].[GetInspectionIDFromUserComments](SYEL.UserComments) <> '0'