December 5, 2013 at 4:03 am
Hi Friends,
My Table strct:
===========
create table show_bus
(
id int identity,
from_p varchar(100),
to_p varchar(100),
timin time
)
My Expecting OUTPUT:
================
insert into show_bus values('a','b','6:05 AM')
when i tried to enter these format its showing error on sql server 2000
kindly help to me
December 5, 2013 at 4:49 am
you need to Convert/Cast this value in Time to be inserted properly.
whether its 2000 or 2008.
December 5, 2013 at 5:25 am
The code works fine for me using SQL Server 2008 R2 although casting it beforehand is still a good idea.
Mark
December 5, 2013 at 5:29 am
Here's how you can get it back out as AM/PM:
select CONVERT(varchar(15),CAST(timin AS TIME),100) as convtimein, * from show_bus
Mark
January 1, 2014 at 2:12 pm
raghuldrag (12/5/2013)
Hi Friends,My Table strct:
===========
create table show_bus
(
id int identity,
from_p varchar(100),
to_p varchar(100),
timin time
)
My Expecting OUTPUT:
================
insert into show_bus values('a','b','6:05 AM')
when i tried to enter these format its showing error on sql server 2000
kindly help to me
You need to pay attention to what the error is saying. 😉 The TIME datatype isn't available in SQL Server 2000. Store the time in a DATETIME datatype and format it when you select from it.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply