我怎么能将“努力”改为“T-SQL”的日期?
我的测试案例是: 24.04.2012
。
我怎么能将“努力”改为“T-SQL”的日期?
我的测试案例是: 24.04.2012
。
http://msdn.microsoft.com/en-us/library/ms187928v=sql.90%29.aspx”
CONVERT(DateTime, DateField, 104)
假设管理系统服务器是2012年或2012年以上,这里的解决办法是行之有效的。 基本声明包括网上审判:
SELECT TRY_PARSE( 02/04/2016 10:52:00 AS datetime USING en-US ) AS Result;
在此,我们在生产版本中执行的内容:
UPDATE dbo.StagingInputReview
SET ReviewedOn =
ISNULL(TRY_PARSE(RTrim(LTrim(ReviewedOnText)) AS datetime USING en-US ), getdate()),
ModifiedOn = (getdate()), ModifiedBy = (suser_sname())
-- Check for empty/null/ NULL text
WHERE not ReviewedOnText is null
AND RTrim(LTrim(ReviewedOnText))<>
AND Replace(RTrim(LTrim(ReviewedOnText)), , ) <> NULL ;
经修改 各栏仅用于内部数据库跟踪。
See also these Microsoft MSDN references:
虽然“CONVERT”是行之有效的,但你实际上却不使用。 你们应该问一下,为什么你们把扼制的价值观划归Server。 如果这是一项一次性的工作,你人工确定一些数据,你又一次获得这种数据,那是ok,但如果任何申请都使用,你就应当改变。 最好的办法是使用“日期”数据类型。 如果这是用户的投入,情况就更糟。 然后,你首先应在客户中做一些检查。 如果你真的希望通过SQ-Server期望的日期的扼制值,那么你总是能够使用ISO格式(YYMMDD),并且应当自动转换。
You can use:
SELECT CONVERT(datetime, 24.04.2012 , 103) AS Date
Reference: CAST and CONVERT (Transact-SQL)
CONVERT(DateTime, ExpireDate, 121) AS ExpireDate
• 开展必要的工作:
2012-04-24 00:00:00.000
I have installed ASP.NET application with database on our server. ASP.NET application created database using connection string below. The problem is that I do not see database in SQL Server Management ...
What datatype is the most efficient to store a number such as 11.111. The numbers will have up 2 digits before the point and up to three after. Currently the column is a bigint , I am guessing that ...
是否需要在提瓜表之后更新表格统计数据,还是自动更新?
Ok, so I ve got a bit of a SQL and Powershell problem. There are 2 SQL scripts, one to setup 4 different global stored procedures. Another to execute them and manipulate data before returning it to PS ...
I add a column of type tinyint and being set to not allow nulls in a table and generate the change scripts. The table has data in it at this time. The script has code that creates a temp table and ...
I am currently working on a particularly complex use-case. Simplifying below :) First, a client record has a many-to-one relationship with a collection of services, that is, a single client may have ...
I have a particularly troublesome xml column to query data from. The schema is fixed by the Quebec Ministry of Revenue so "it is what it is" The important part of the query looks like this: with ...
I ve got a content management system that contains a hierarchical structure of categories, with sub-categories subject to different ordering options at each level. Currently, that s retrieved by a (...