能否请您看一下下面的查询?我试图将我的访问表转换为很少了解的SQL查询(目前)。
执行时,最后一行似乎是错误的。
USE [idb_datastore]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[idb_dataSTORESQLTesting]
AS
IF OBJECT_ID( 'idb_datastore.dbo.[Testing]','U' ) IS NOT NULL
DROP TABLE idb_datastore.dbo.[Testing];
SELECT dbo.REC_HDR.F91 AS [PO Number],
hd.F1032 AS [Trs Number],
hd.F76 AS [Order Date],
hd.F27 AS [Vendor ID],
hd.F334 AS [Vendor Name],
hd.F1246 AS [Delivery Date],
hd.F1127 AS [Operator Short Name],
hd.F1068 AS State,
hd.F1067 AS Status
FROM SMSSERVER01.STORESQL.dbo.REC_HDR hd
WHERE hd.F91 Is Not Null AND hd.F76 >= Convert(datetime, ’2017/01/01’ ) AND
hd.F1068 NOT like ’Voided’
答案 0 :(得分:0)
SQL日期时间格式为yyyy-mm-dd hh:mm:ss
将最后一行更改为此
Convert(datetime, '2017-01-01' )
答案 1 :(得分:0)
将where句子更改为此
F91 hd不为空 AND hd.F76> = CONVERT(DATETIME,'03 / 13/2013',101) 和hd.F1068不喜欢'%Voided%'