我现在如何在SQL Server mgmtstudioÜ内部使用DATETIME进行插入 [英] How do I do an insert with DATETIME now inside of SQL server mgmt studioÜ
本文介绍了我现在如何在SQL Server mgmtstudioÜ内部使用DATETIME进行插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个确实插入下表的网站.我需要进行一些手动插入,但是我不确定如何在C#中传递等效于DateTime.Now的信息.
I have a website that does inserts into this table below. I need to do some manual inserts but I wasn't sure how do pass in the equivalent of DateTime.Now in C#.
我正在下面从SQL Server mgmt studio中的查询编辑器运行此文件.下面的查询中有什么方法可以传递当前日期时间.
I am running this below from the query editor in SQL server mgmt studio. Is there any way to pass in the current date time in this query below.
INSERT INTO [Business]
([IsDeleted]
,[FirstName]
,[LastName]
,[LastUpdated]
,[LastUpdatedBy])
VALUES
(0, 'Joe', 'Thomas',
,<LastUpdated, datetime,>
,<LastUpdatedBy, nvarchar(50),>)
推荐答案
使用 CURRENT_TIMESTAMP(或旧版本的SQL Server上为GETDATE()).
Use CURRENT_TIMESTAMP (or GETDATE() on archaic versions of SQL Server).
这篇关于我现在如何在SQL Server mgmtstudioÜ内部使用DATETIME进行插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文