|
我sys.[views]将重点放在关键值上,以便与另一台服务器上的值进行比较,以进行一致性测试。我遇到了一个返回错误的问题。
1 b5 e* T. Q! q. K# W! }& k nMsg 8167,16级,状态1,51行: y3 K) c3 K2 Z
列出类型的类型和UNPIVOT列表中指定的其他列类型的冲突。
. }6 b3 I& L3 I$ t询问:
6 w$ F) u$ i! t+ X5 V3 ~; I1 t( JSELECTsourceUnpivoted.idServer,sourceUnpivoted.sourceServerName,sourceUnpivoted.name,sourceUnpivoted.columnName,sourceUnpivoted.columnValueFROM (SELECT CAST('1' AS VARCHAR(255)) AS idServer,CAST('thisOne' AS VARCHAR(255)) AS sourceServerName,CAST('theDatabase' AS VARCHAR(255)) AS sourceDatabaseName,CAST(name AS VARCHAR(255)) AS name,CAST(object_id AS VARCHAR(255)) AS object_id,CAST(principal_id AS VARCHAR(255)) AS principal_id,CAST(schema_id AS VARCHAR(255)) AS schema_id,CAST(parent_object_id AS VARCHAR(255)) AS parent_object_id,CAST(type AS VARCHAR(255)) AS type,CAST(type_desc AS VARCHAR(255)) AS type_desc,CAST(create_date AS VARCHAR(255)) AS create_date,CAST(lock_escalation_desc AS VARCHAR(255)) AS lock_escalation_desc...FROM noc_test.dbo.stage_sysTables) AS databaseTablesUNPIVOT (columnValue FOR columnName IN (object_id,principal_id,schema_id,parent_object_id,type,type_desc,create_date,lock_escalation_desc) ) AS sourceUnpivoted为什么不喜欢呢?[type],[type_desc],[lock_escalation_desc]???1 [( M C+ o* z/ h t( E
我也尝试过CONVERT(VARCHAR(255),type) AS type) y1 S6 f1 z( P# \0 v$ \
0 Q/ [, o- N0 j0 s8 c c 解决方案: |
|