DECLARE @count INT
DECLARE @intFlag INT
DECLARE @PropertyName Varchar(20)
SET @intFlag = 1
SELECT @count = COUNT(*) FROM PropertyList
WHILE (@intFlag <= @count)
BEGIN
SELECT @PropertyName =PropertyName FROM PropertyList WHERE PropertyNumber = @intFlag
SET @intFlag = @intFlag + 1
SELECT C.AGO_Exc, + 'C.' + @PropertyName FROM [Crude Data] C
END
GO!
结果集在附图中。我真正想要的是'C' + @PropertyName应该充当列名。我怎么能这样做。