Answers:
派生表
SELECT
EMail,
hashbytes('SHA1', EMail) AS HashedEmail
FROM
(
SELECT LOWER(SUBSTRING([NAME], 4, 100)) + '@somedomain.com' as EMail
FROM sometable
) foo
或CTE:
;WITH cEMail AS
(
SELECT LOWER(SUBSTRING([NAME], 4, 100)) + '@somedomain.com' as EMail
FROM sometable
)
SELECT
EMail,
hashbytes('SHA1', EMail) AS HashedEmail
FROM
cEMail