2016-06-13 11 views
1

これは私のSQLクエリです。このクエリを実行中に、私は上記のエラーが発生しています文字列からuniqueidentifier sqlサーバーに変換するときに変換に失敗しました。2014

WITH Results_CTE AS (select Top 20 ROW_NUMBER() OVER (ORDER BY KeyId desc) AS SNo,* from(select * from ( select ps.Id as KeyId,dps.Id as SettingId,dps.DocumentType,dps.DocumentProcessingType,null as Description,null as Link 
      from [ParttimerSalary] ps inner join [ParttimerEmployee] pe on pe.Id = ps.ParttimerEmployeeId 
      inner Join [DocumentProcessingSetting] dps on dps.Step = ps.Step and dps.KeyId = pe.ParttimerType and 
      (dps.RoleId = 'e218e9e0-d51d-45b4-9380-77f43ac50f0d' or dps.UserId = '1967681a-7d64-486e-99a8-4b58746cef81') and dps.DocumentType = 2 union all 
      Select 'Incident/service is assigned for you' as [Description],'#/it/incidentsupport/' as Link,0 as Id,0 as SettingId,0 as DocumentType,0 as DocumentProcessingType from Incident where IncidentStatus = 2 and SupportById = '1967681a-7d64-486e-99a8-4b58746cef81' 
      )wrapped) listing ORDER BY KeyId desc) SELECT * FROM Results_CTE WHERE SNo >= 0 AND SNo <=20 

助けていただければ幸いです。ありがとう

答えて

1

すべてのデータ型は、両方のselect要素で一致する必要があります。

  • ps.Id KeyIdは一意のIDですが、[説明]はエラーの原因となる文字列ですので、「インシデント/サービスが割り当てられています。
0

実は、私は労働組合の間のように、労働組合のキーワードの後に​​テーブルから列を選択する順序を変更していた、我々は両方のテーブル の分野でなど、順序、データ型を管理する必要があり、問題が解決されました。 とにかく感謝

関連する問題