如果您按照上面的方法操作,那么答案是“是”,您必须在WHERE子句中重新创建它。
作为替代方案,您可以使用内联视图:
Select
...
, X.theString
,...
From table1 Join table2 on table1pkey=table2fkey
, (SELECT
string1
,Left(
left((select top 1 strval from dbo.SPLIT(string1,' ')) //first word
,1) //first character
+ (select top 1 strval from dbo.SPLIT(string1,' ')
//second word
where strval not in (select top 1 strval from dbo.SPLIT(string1,' ')))
,6) theString //1st character of 1st word, followed by up to 5 characters of second word
FROM table1
) X
Where X.theString <> table2.someotherfield
AND X.string1 = <whatever you need to join it to>