Курсовая работа: Автоматизированная система бронирования авиабилетов
execute dbo.sp_executesql @statement = N'CREATE FUNCTION [dbo].[timeFlight]
(
@dateArrival datetime,
@dateDeparture datetime
)
RETURNS char(5)
BEGIN
RETURN
convert(char(2),datediff(hh,@dateDeparture,@dateArrival))+'':''+
convert(char(2),datediff(mi,@dateDeparture,@dateArrival)-datediff(hh,@dateDeparture,@dateArrival)*60)
END'
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Flights]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Flights](
[FlightID] [int] IDENTITY(1,1) NOT NULL,
[DateDeparture] [datetime] NULL,
[DateArrival] [datetime] NULL,
[Price1] [decimal](18, 0) NULL,
[Price2] [decimal](18, 0) NULL,
[CompanyID] [int] NULL,
[AircraftID] [int] NULL,
[CityDepartureID] [int] NULL,
[CityArrivalID] [int] NULL,