SqlServer行转列
STUFF替换第一个逗号为空。SELECTSTUFF((SELECT ','+CONVERT(NVARCHAR(20),S.ModelScenarioUID)FROM enstep.DealModelScenarios sINNER JOIN enstep.DealModelScenarioTypes dt ON dt.ScenarioTypeUID = s.ScenarioTypeUIDWHER
·
STUFF替换第一个逗号为空。
SELECT
STUFF(
(select
',1,
2'
)
,1,1,'')
SELECT
STUFF(
(SELECT ','+CONVERT(NVARCHAR(20),S.ModelScenarioUID)
FROM enstep.DealModelScenarios s
INNER JOIN enstep.DealModelScenarioTypes dt ON dt.ScenarioTypeUID = s.ScenarioTypeUID
WHERE dt.ScenarioType='EOD-Official' AND dt.OfficialFlag='Y' AND s.InactiveFlag='N' AND s.CurveDate>=@CurveDate
FOR xml path('')
)
,1,1,'')
更多推荐
所有评论(0)