CREATE TABLE [dbo].[MachineData](
	[MachineDataCode] [int] IDENTITY(1,1) NOT NULL,
	[MachineNo] [int] NOT NULL,
	[IPAddress] [nvarchar](50) NOT NULL,
	[PortNo] [int] NOT NULL,
	[InVal] [nvarchar](20) NOT NULL,
	[OutVal] [nvarchar](20) NOT NULL,
	[HavePassword] [bit] NOT NULL,
	[Password] [nvarchar](50) NULL,
	[MachinDirection] [int] NULL,
	[IsActive] [bit] NOT NULL,
	[MachineFunction] [int] NULL,
	[MachineName] [nvarchar](200) NULL,
	[SerialDevice] [nvarchar](200) NULL,
	[ApiPort] [int] NULL,
	[IsRealTime] [bit] NULL,
 CONSTRAINT [PK_MachineData] PRIMARY KEY CLUSTERED 
(
	[MachineDataCode] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE dbo.MachineData ADD
GroupCode int NOT NULL CONSTRAINT DF_MachineData_GroupCode DEFAULT 1
GO
ALTER TABLE dbo.MachineData
ADD IsEmployeeFromEmpEX bit NULL DEFAULT ((0))
GO
ALTER TABLE dbo.MachineData ADD CONSTRAINT
	DF_MachineData_IsRealTime DEFAULT ((0)) FOR IsRealTime

GO
ALTER TABLE MachineData
ADD 
PathUrlSolutionMachine NVARCHAR(255) NULL,
UserNameSolution NVARCHAR(255) NULL,
PasswordSolution NVARCHAR(255) NULL,
DeviceMachine INT NULL;