【发布时间】:2009-09-20 10:53:39
【问题描述】:
我有以下问题
声明@ProductIdsToExclude nvarchar(max)
SET @ProductIdsToExclude = '49506541-4CE2-40AC-812A-7AB262E6F0B0,49506541-4ce2-40ac-812a-7ab262e6f0b0'
然后我使用this 函数将@ProductIdsToExclude 解析为临时表:
创建表
#TempProductIdsToExclude (ProductId 唯一标识符)
插入
#TempProductIdsToExclude (ProductId)
选择
t.txt_value
来自
dbo.fn_ParseText2Table(@ProductIdsToExclude,',') as t
然后我使用这个查询来提取所有产品:
从产品中选择 *
我的问题是 - 如何让查询 排除 Products 表中的 ProductId 包含在 中的所有结果>#TempProductIdsToExclude
谢谢!
【问题讨论】:
标签: sql sql-server-2008