Question : Create Table (MS SQL 2008) with Time Column that accepts 14:00 format only

Hello Experts,

Is it possible to create a table with a time column that accepts the data in the current format only  -
HH:MM???

Please advice, my current table is below, it's the SameDayDeliveryTime column I am hoping to change...

thank you
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
CREATE TABLE [dbo].[Florist](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[FloristName] [nvarchar](75) NULL,
	[Phone] [nvarchar](20) NULL,
	[Email] [nvarchar](255) NULL,
	[SameDayDelivery] [char](1) NULL,
	[SameDayDeliveryTime] [datetime] NULL,
	[HomePageText] [nvarchar](max) NULL,
	[PayPalUserID] [nvarchar](255) NULL,
	[Region] [nvarchar](75) NULL,
	[metatitle] [nvarchar](250) NULL,
	[metadescription] [nvarchar](1000) NULL,
	[metakeywords] [nvarchar](500) NULL,
	[AboutUsText] [nvarchar](max) NULL,
	[Address1] [nvarchar](100) NULL,
	[Address2] [nvarchar](100) NULL,
	[Address3] [nvarchar](100) NULL,
	[PostCode] [nvarchar](10) NULL,
	[sucessurl] [nvarchar](50) NULL,
	[failureurl] [nvarchar](50) NULL,
	[domainname] [nvarchar](250) NULL,
	[Analytics] [nvarchar](1000) NULL
) ON [PRIMARY]

GO

Answer : Create Table (MS SQL 2008) with Time Column that accepts 14:00 format only

>do I have to specify the field size
no, you cannot.

>so that i just get hh:mm
that will only be during select:
1:
2:
select SameDayDeliveryTime , convert(char(5), SameDayDeliveryTime , 8 ) formatted_SameDayDeliveryTime 
  from [dbo].[Florist]
Random Solutions  
 
programming4us programming4us