このエラーに詳しい方は?どうもありがとう:)オペランドタイプの衝突:smalldatetimeがuniqueidentifierと互換性がありません
マイコード:
declare @FromDate date
declare @ToDate date
set @FromDate = '2017/01/01'
set @ToDate = '2017/02/28'
/*********************** INVOICE DETAILS **************************************/
--declare @FromDate date
--declare @ToDate date
--set @FromDate = '1/1/2017'
--set @ToDate = '2/28/2017'
if object_id('tempdb..#tmpInvoiceDetails') IS NOT NULL
begin
drop table #tmpInvoiceDetails
end
create table dbo.#tmpInvoiceDetails
(
[PurchaseOrderKey] uniqueidentifier,
[AgreementKey] varchar(40),
[CreatedDate] datetime,
[SalesOrderID] varchar(30),
[ConfirmedInvoiceNumber] varchar(50),
[CurrencyCode] varchar(5),
[ExtendedLineItemAmount] int,
[ExtendedLineItemAmountUSD] int
)
insert into dbo.#tmpInvoiceDetails
(
[PurchaseOrderKey],
[AgreementKey],
[CreatedDate],
[SalesOrderID],
[ConfirmedInvoiceNumber],
[CurrencyCode],
[ExtendedLineItemAmount],
[ExtendedLineItemAmountUSD]
)
select
[CreatedDate],
[SalesOrderID],
[PurchaseOrderKey],
[AgreementKey],
[ConfirmedInvoiceNumber],
[CurrencyCode],
[ExtendedLineItemAmount],
[ExtendedLineItemAmountUSD]
from [dbo].[SalesOrderLineItem]
where [CreatedDate] >= @FromDate
and [CreatedDAte] < @ToDate
--create index on temp audit table
create nonclustered index [tmpIDX] on [dbo].[#tmpInvoiceDetails]
(
[CreatedDate] ASC,
[PurchaseOrderKey] ASC
)
私はこのエラーを取得する:
Msg 206, Level 16, State 2, Line 31
Operand type clash: smalldatetime is incompatible with uniqueidentifier.
私はすでに日付形式が、それでも同じように変更してみました。
など、
ので良いSQLの質問をする方法[お読みください](http://meta.stackoverflow.com/questions/271055/tips-for-asking-a-good-structured-query-language-sql-question/271056)と[MCVEを作成する方法](http: /stackoverflow.com/help/mcve) – Shnugo
私の謝罪、私は自分の投稿を編集しました。 :) –