不确定如何创建此 UDF。我已经阅读了现有的问题,但不确定语法。
我想将此查询另存为视图,但不能因为我已经有声明
DECLARE @STARTDATE DATETIME
DECLARE @ENDDATE DATETIME
SELECT @ENDDATE = CAST(CONVERT(CHAR(10), GETDATE(), 101)+' 00:00:00' AS DATETIME)
SELECT @STARTDATE = DATEADD(D, -1, @ENDDATE)--'-7'
SELECT @ENDDATE = CAST(CONVERT(CHAR(10), GETDATE(), 101)+' 23:59:59' AS DATETIME)
SELECT
LTRIM(CIJ.ORDERACCOUNT) 'ACCOUNT'
,LTRIM(CIJ.SALESID) 'TOMKIN ORDER #'
,LTRIM(CIJ.INVOICEID) 'TOMKIN INVOICE #'
,CIJ.PURCHASEORDER 'YOUR ORDER #'
FROM
CUSTINVOICEJOUR CIJ
WHERE
CIJ.INVOICEDATE >= @STARTDATE AND CIJ.INVOICEDATE <= @ENDDATE
ORDER BY
CIJ.INVOICEDATE,CIJ.INVOICEID
任何帮助将不胜感激