开发者

SQL Server Management Studio - Shortcut for entering Dates?

开发者 https://www.devze.com 2022-12-18 16:52 出处:网络
In SSMS, when editin开发者_JS百科g 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?This page http://ms

In SSMS, when editin开发者_JS百科g 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?


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

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.


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.

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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号