节省时间到Sql Server并检索它 [英] Saving Time to Sql Server and Retrieving it

查看:73
本文介绍了节省时间到Sql Server并检索它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在申请制定组织时间表。

在制定时间表时,我想以1:30或2:15的字符串格式为任何成员分配工作时间。 />
我应该如何将它存储在数据库中并对其进行操作。即要使用的数据类型或将DBType.Time转换为时间戳????

解决方案

检查Bellow示例



  DECLARE   @ TimeOnly  
TIMEonly TIME 默认 CURRENT_TIMESTAMP ));

INSERT INTO @ TimeOnly (TIMEonly) VALUES CONVERT VARCHAR 8 ),GETDATE(), 108 ))
@ TimeOnly * >

I am making an applcation for making schedule for organization.
While making schedule I want to assign time for work to any member in format of string like 1:30 or 2:15.
How should I store it in database and manipulate it. i.e datatypes to be used or to convert DBType.Time to Timestamp????

解决方案

Check for Bellow example

DECLARE @TimeOnly TABLE (
TIMEonly TIME default (CURRENT_TIMESTAMP));

INSERT INTO @TimeOnly(TIMEonly) VALUES(CONVERT(VARCHAR(8),GETDATE(),108))
Select * from @TimeOnly


这篇关于节省时间到Sql Server并检索它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆