Solved

Time field in SQL Server 6.5

Posted on 1998-12-07
4
192 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 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

690 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