0

i have one crm application. i want to store conversions date and specific time at which time that thread created that to show. how ever i have also one [datetime] column but time is not correct. event though this time part should be default from sql. how ever i want this time part is accurate and how i implement this. is that way to store acuurate time part from sql.

is that way to store time part from getdate function of sql.

for more reference i put table

Inquiry_id   varchar(50)    
Inquiry_subject  varchar(50)    
Service_id   numeric(18, 0) 
Priority_id  numeric(18, 0) 
User_id          varchar(50)    
Status_id    numeric(18, 0)
body             varchar(1024)
Email_Address    varchar(50)    
IsDisplay    bit    
IsRead           bit
IsReplied    bit    
TimeStamp   datetime    
Activity_start_time datetime    
Activity_expire_time    datetime

please help me..

4

1 回答 1

1

要将您的 DateTime 列显示为 Date 和单独的 Time 列,请在 SELECT 语句(或视图)中执行此操作

SELECT 
  CONVERT(VarChar(20), Activity_Start_Time, 108) AS ActivityStartTime,
  CONVERT(VarChar(30), Activity_Start_Time, 101) AS ActivityStartDateUS
FROM YourExampleTableAbove

这将产生类似的结果

ActivityStartTime   ActivityStartDateUS
-----------------   -------------------
08:10:27            4/23/2013
15:58:40            4/29/2013

有关更多选项,请阅读 TSQL 的 Convert() 函数http://msdn.microsoft.com/en-us/library/ms187928.aspx

于 2013-11-07T14:14:18.990 回答