Я хочу выполнить эту процедуру, но SQL скажите мне об этой ошибке 'Тип столбца "q82" конфликтует с типом других столбцов, указанных в списке UNPIVOT "
все Q имеют значение INT
Кто-нибудь знает решение?
INSERT INTO [stg]. [Fact_answer_cc]
(
[user_id],
[question_id],
[answer],
[check_sum]
)
SELECT
[q2] AS [user_id],
[question_id],
[answer],
HASHBYTES (
N'SHA1',
ISNULL ( CAST([q2] AS VARCHAR), '' ) + @pipe_delimiter +
ISNULL ( CAST([question_id] AS VARCHAR), '' )
) AS [check_sum]
FROM
(
SELECT
[q2],
[q80],
[q81],
[q82],
[q83],
[q84],
[q85],
[q86],
[q87],
[q88],
[q89],
[q90],
[q91],
[q92]
FROM
[src].[qa_data_cc]
) AS t
UNPIVOT
(
[answer] FOR [question_id] IN
(
[q80],
[q81],
[q82],
[q83],
[q84],
[q85],
[q86],
[q87],
[q88],
[q89],
[q90],
[q91],
[q92]
)
) AS unpvt
ORDER BY
[user_id],
[question_id];