?
Solved

Time field in SQL Server 6.5

Posted on 1998-12-07
4
Medium Priority
?
194 Views
Last Modified: 2010-03-19
I'm trying to migrate a MSAccess database to SQL Server 6.5 In MsAccess I have 2 time fields defined as "short time".
I just realized there is no such datatype in SQL Server. Is there a way to handle this using the "small datetime" type?

If you know the answer, please post an example, as I'm not very familiar with SQL Server

Help appreciated,

Ion
0
Comment
Question by:iamari
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
spiridonov earned 800 total points
ID: 1092116
There is only datetime and small datetime field in SQL Server, that consists of date and time. there is no date or time datatypes. you should use either character field or datetime and CONVERT function to return only time part of datetime.
0
 
LVL 2

Author Comment

by:iamari
ID: 1092117
The problem is not so much how to display only the time, but how to insert only time from a web form? The user will just type something like 23:15

Can the CONVERT function be used to do this? How?

Ion
0
 
LVL 7

Expert Comment

by:spiridonov
ID: 1092118
You can insert just '23:15', it will default to 1/1/1900 23:15 there is no way to have only time.
Example:
create table test (tt datetime )
go
insert into test values ('23:15')
select * from test
Result:
(1 row(s) affected)

tt                          
---------------------------
1 Jan 1900 23:15            

(1 row(s) affected)
0
 
LVL 2

Author Comment

by:iamari
ID: 1092119
Thanks a lot, it works!

Ion
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question