我的sql server是编译每个程序,sql server不关心是否有一些语法错误,它编译,但intellisense运行良好
例如,最后查看注释INNER JOIN
ALTER PROC [dbo].[Sky-Disparador-Many-Select-GetUsersInMailing] --22,1--ORA_P7FE_1DP7_A_24NOV16_10,3236
@dateD INT
, @contactMedia INT
AS
SELECT customer.cpfCnpj [cpf]
, contact.Contact [contato]
, customer.pk_CustomerId [contrato]
, arrearsStep.Discoun t [PercentualDesconto]
, Camp.pk_CampaignId [campaingId]
, customer.CustomerName [nome]
, cc.pk_CustomerContextId [CustomerContextId]
, contact.pk_ContactId [ContactId]
FROM [db_sacapp_customer].[dbo].[Customer] customer
LEFT JOIN [db_sacapp_customer].[dbo].[Contact] contact
ON contact.fk_CustomerId = customer.pk_CustomerId
INNER JOIN CustomerContext cc
ON cc.fk_CustomerId = customer.pk_CustomerId
INNER JOIN [db_sacapp_customer].[dbo].[CustomerContext_X_Debt] ccXd
ON cc.pk_CustomerContextId = ccXd.fk_CustomerContextId
INNER JOIN Debt
ON ccXd.fk_DebtId = pk_DebtId
LEFT JOIN [db_sacapp_customer].[dbo].[Payment] payment
ON Debt.[pk_DebtId] = payment.[fk_DebtId]
AND payment.[fk_DebtId] IS NULL
INNER JOIN [db_sacapp_customer].[dbo].[Campaign] Camp
ON cc.fk_CampaignId = Camp.pk_CampaignId
INNER JOIN [db_sacapp_customer].[dbo].[ActionRule] ACT
ON ACT.pk_ActionRuleId = Camp.fk_ActionRuleId
INNER JOIN [db_sacapp_customer].[dbo].[ArrearsStep_X_ActionRule] x
ON x.fk_ActionRuleId = ACT.pk_ActionRuleId
INNER JOIN [db_sacapp_customer].[dbo].[ArrearsStep] arrearsStep
ON x.fk_ArrearsStepId = arrearsStep.pk_ArreacccxcxcxzfdsafsdfrsStepId --Example: the intellisense work and say this is wrong, but the sql server compile it (Command(s) completed successfully.)
WHERE Debt.D BETWEEN arrearsStep.DStart
AND arrearsStep.DEnd
--and customer.pk_CustomerId in (5037281)
AND contact.fk_ContactMedia = @contactMedia
我已经关闭sql(sql进程)并打开,刷新数据库和很多东西
答案 0 :(得分:1)
在SQL Server中,对象评估不是在编译时进行,而是在运行时进行。因此,只要语法正确,您就可以编译任何SQL代码,无论它引用的对象是否存在。
你在问题中说的是你有"语法"错误,但事实并非如此。无效的列名与语法无关。
有关详细信息,请查看Deferred Name Resolution and Compilation