SQL Server Management Studio -进入日期的快捷方式?

时间:2022-02-03 10:07:02

In SSMS, when editing a row of data in a table, you can press Ctrl+0 to enter a null in the current cell. Is there any shortcut for entering the current date in a cell?

在SSMS中,当编辑表中的一行数据时,可以按Ctrl+0在当前单元格中输入null。在单元格中是否有进入当前日期的快捷方式?

2 个解决方案

#1


9  

This page http://msdn.microsoft.com/en-us/library/ms175917.aspx has the shortcut documentation for the SQL Table Editor.

此页面http://msdn.microsoft.com/en-us/library/ms175917.aspx为SQL表编辑器提供了快捷文档。

Under "Results Pane" it specifies the available shortcuts including "Enter null into a cell: CTRL+0". There are no other shortcuts listed that would do what you wish, so I would say you're out of luck with any easy out of the box trick.

在“结果窗格”下,它指定了可用的快捷方式,包括“将null输入到单元格中:CTRL+0”。没有其他捷径可以做你想做的,所以我想说你运气不好,没有任何简单的开箱诡计。

#2


6  

Well, you can add GetDate() as the default value of the column.
Then, if you fill in the other fields in a new row, and do nothing in your date field, it will add the current date when saving the new row.

可以将GetDate()添加为列的默认值。然后,如果在新行中填充其他字段,并且在日期字段中不做任何操作,它将在保存新行时添加当前日期。

EDIT: Another solution, if you are an AutoHotkey user (or want to be) is to create an application-specific hotkey that inserts the current date.

编辑:另一个解决方案,如果您是AutoHotkey用户(或想要成为),则是创建一个特定于应用程序的热键,插入当前日期。

FormatTime,CurrentDate,,M/d/yyyy
#IfWinActive,Microsoft SQL Server Management Studio
    ^9::SendInput,%CurrentDate%
return

You can add {RIGHT} after %CurrentDate% to automatically move to the next cell.
You can add h:mm or h:mm tt to the first line to include the current time.

可以在%CurrentDate%之后添加{RIGHT},以自动移动到下一个单元格。你可以添加h:mm或h:mm tt到第一行,包括当前时间。

#1


9  

This page http://msdn.microsoft.com/en-us/library/ms175917.aspx has the shortcut documentation for the SQL Table Editor.

此页面http://msdn.microsoft.com/en-us/library/ms175917.aspx为SQL表编辑器提供了快捷文档。

Under "Results Pane" it specifies the available shortcuts including "Enter null into a cell: CTRL+0". There are no other shortcuts listed that would do what you wish, so I would say you're out of luck with any easy out of the box trick.

在“结果窗格”下,它指定了可用的快捷方式,包括“将null输入到单元格中:CTRL+0”。没有其他捷径可以做你想做的,所以我想说你运气不好,没有任何简单的开箱诡计。

#2


6  

Well, you can add GetDate() as the default value of the column.
Then, if you fill in the other fields in a new row, and do nothing in your date field, it will add the current date when saving the new row.

可以将GetDate()添加为列的默认值。然后,如果在新行中填充其他字段,并且在日期字段中不做任何操作,它将在保存新行时添加当前日期。

EDIT: Another solution, if you are an AutoHotkey user (or want to be) is to create an application-specific hotkey that inserts the current date.

编辑:另一个解决方案,如果您是AutoHotkey用户(或想要成为),则是创建一个特定于应用程序的热键,插入当前日期。

FormatTime,CurrentDate,,M/d/yyyy
#IfWinActive,Microsoft SQL Server Management Studio
    ^9::SendInput,%CurrentDate%
return

You can add {RIGHT} after %CurrentDate% to automatically move to the next cell.
You can add h:mm or h:mm tt to the first line to include the current time.

可以在%CurrentDate%之后添加{RIGHT},以自动移动到下一个单元格。你可以添加h:mm或h:mm tt到第一行,包括当前时间。