Solved

Time field in SQL Server 6.5

Posted on 1998-12-07
4
180 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
  • 2
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
spiridonov earned 200 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

786 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