我需要使用自定义列名称来旋转表格.请参阅下面的表格格式.
目前的格式:
ID question Answer
4482515 I would like to be informed by mail. No
4482515 Plan to Purchase? Over 12 months
4482515 Test Question Text some Answer
Run Code Online (Sandbox Code Playgroud)
我想以下列格式显示数据.
所需格式:
ID question 1 Answer1 question 2 Answer 2
4482515 I would like to be informed by mail. NO Plan to Purchase? Over 12 months
Run Code Online (Sandbox Code Playgroud)
请注意:我不知道连续的问题和答案的数量,因此应该动态生成列的问题1 Answer1.
谢谢
编辑:感谢您的帮助,我试一试您提供给我的动态代码并收到此错误.
Msg 8167, Level 16, State 1, Line 1
The type of column "answer" conflicts with the type of other columns …Run Code Online (Sandbox Code Playgroud)