Когда я запускаю эту хранимую процедуру в базе данных SQL Azure:
select c.ID, c.ContractIDText, c.ContractID, c.TpwrId, c.ContractType as ContractType, c.Status as StatusName, c.Grantee as GranteeName,
c.Contact as ContactName, c.EffectiveDate, c.OptionToExtend, c.OptionExercised, t.ID as Term,
RANK() OVER (PARTITION BY c.ContractID ORDER BY t.Sequence) as Sequence,
CASE WHEN t.TimePeriod is null then e.DueDate
WHEN t.TimePeriodUnits = 'Years' then DATEADD(Year, -t.TimePeriod, e.DueDate)
WHEN t.TimePeriodUnits = 'Months' then DATEADD(Month, -t.TimePeriod, e.DueDate)
WHEN t.TimePeriodUnits = 'Days' then DATEADD(Day, -t.TimePeriod, e.DueDate)
WHEN t.TimePeriodUnits = 'Weeks' then DATEADD(Day, -(t.TimePeriod*7), e.DueDate)
ELSE e.DueDate end as PerceivedEffectiveDate,
t.TermType as TermTypeName, t.TimePeriod, t.TimePeriodUnits as TermUnitTypeName, e.DueDate as ExpireDate,
CAST(t.TimePeriod AS NVARCHAR) + ' ' + t.TimePeriodUnits as TimeAndUnits,
DATEDIFF(Day, CURRENT_TIMESTAMP, e.DueDate) as DaysAway, assetname, County,[Block], Section, ISNULL(Grantor, 'Texas Pacific Land Trust') Grantor
from [dbo].[Contract] c inner join
[dbo].[Term] t on t.ContractID = c.ID inner join
[dbo].[Resolution] e on e.TermID = t.ID and (e.ResolutionDescription is null or e.ResolutionDescription = '' or e.ResolutionDate is null or e.ResolutionType is null) left outer join
[dbo].[Contracts_Tracts] ct on ct.contractid = c.id left outer join
[dbo].[Tract] tr on tr.id = ct.tractid left outer join
[dbo].[Land_Surveys] ls on ls.id = tr.landsurveyid left outer join
[dbo].[Asset] a on a.id = ls.assetid
where t.TermType <> 'Perpetual' and
(
c.ContractType in ('Water: Temporary Produced Water Pipeline Permit', 'Water: Temporary Fresh Water Pipeline Permit', 'Water: Salt Water Disposal Load Station Site', 'Water: Salt Water Disposal Letter Agreement','Water: Salt Water Disposal & Facility', 'Water: Salt Water Disposal Facility', 'Water: Salt Water Disposal', 'Water: Salt Water Disposal & Facility', 'Water: Temporary Pipeline Right-Of-Way and Easement', 'Water: Produced Water Pipeline Easement','Multi-Use Pipeline Easement','Water: Temporary Water Pipeline Permit'))
я получаю:
The data type of the column 'TpwrId' in the external table is different than the column's data type in the underlying standalone or sharded table present on the external source.
Единственное, что изменилось, о чем я могу думатьперемещает эту базу данных в эластичный пул.Я думаю, что это как-то связано с запросами к нескольким базам данных.
ContractIdText (получит ту же ошибку, если я удалю TpwrId) - это вычисляемый столбец, использующий TpwrId.ContractIdText / TpwrId находится в базе данных A, а хранимая процедура находится в базе данных B. Они оба находятся в эластичном пуле.Сообщение об ошибке несколько странно для меня.
Спасибо за любую помощь.