为什么momentjs isSameOrBefore和isSameOrAfter函数不适用于哪些isBefore和适用的数据isAfter?
以下是一些非常简单的孤立示例,其中isSameOrBefore和isSameOrAfter不起作用:
moment("2018-10-12 10:44:01").isSameOrBefore(moment("2018-10-12 10:44:00"))
TypeError: moment(...).isSameOrBefore is not a function [Learn More]
moment("2018-10-12 10:44:01").isSameOrAfter(moment("2018-10-12 10:44:02"))
TypeError: moment(...).isSameOrAfter is not a function [Learn More]
Run Code Online (Sandbox Code Playgroud)
但是使用相同类型的数据,isBefore并且isAfter工作正常:
moment("2018-10-12 10:44:01").isBefore(moment("2018-10-12 10:44:00"))
false
moment("2018-10-12 10:44:01").isAfter(moment("2018-10-12 10:44:02"))
false
moment("2018-10-12 10:44:00").isBefore(moment("2018-10-12 10:44:01"))
true
moment("2018-10-12 10:44:02").isAfter(moment("2018-10-12 10:44:01"))
true
Run Code Online (Sandbox Code Playgroud) 我已成功将分区添加到表(日志),但需要创建一个回滚脚本,以防需要删除它。不幸的是,现在已经失败了,由于回滚脚本中途失败,日志现在没有主键,当我收到错误时,我无法将其添加回来......
列“SuperLogId”是索引“PK__Logs__0E6B88F2”的分区列。唯一索引的分区列必须是索引键的子集。
当尝试运行这个时:
ALTER TABLE dbo.Logs
ADD PRIMARY KEY CLUSTERED (Id ASC)
Run Code Online (Sandbox Code Playgroud)
所以我尝试遵循本指南(https://www.patrickkeisler.com/2013/01/how-to-remove-undo-table-partitioning.html),最终不得不编写这个来生成一个脚本来合并我的所有动态创建的分区。
DECLARE @partitionsTable dbo.NVarCharCollectionTableType --User-defined table type to hold a collection of NVarChars.
INSERT INTO @partitionsTable
SELECT CONCAT('ALTER PARTITION FUNCTION Logs_SuperLogId_PartitionFunction() MERGE RANGE (', CONVERT(NVARCHAR, [Value]), ')')
FROM SYS.PARTITION_SCHEMES
INNER JOIN SYS.PARTITION_FUNCTIONS ON PARTITION_FUNCTIONS.FUNCTION_ID = PARTITION_SCHEMES.FUNCTION_ID
INNER JOIN SYS.PARTITION_RANGE_VALUES ON PARTITION_RANGE_VALUES.FUNCTION_ID = PARTITION_FUNCTIONS.FUNCTION_ID
WHERE PARTITION_SCHEMES.Name = 'Logs_SuperLogId_PartitionScheme'
AND PARTITION_FUNCTIONS.Name = 'Logs_SuperLogId_PartitionFunction'
ORDER BY [Value] ASC
DECLARE @statement NVARCHAR(MAX)
SELECT @statement =
CASE
WHEN @statement IS NULL …Run Code Online (Sandbox Code Playgroud)