TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Carnation Flowers
NA
493
35.3k
need help as soon as possible
Mar 14 2017 2:13 PM
i create database and all relations
i have Session table
USE [OnCall]
GO
/****** Object: Table [dbo].[Sessions] Script Date: 03/14/2017 21:08:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Sessions](
[SessionID] [int] NOT NULL,
[PatFileID] [int] NULL,
[DocID] [int] NULL,
[Date] [datetime] NULL,
[PickupOfvistLocation] [nvarchar](max) NULL,
[SessionFees] [decimal](18, 0) NULL,
[MCFees] [decimal](18, 0) NULL,
[DoctorFees] [decimal](18, 0) NULL,
[AppFees] [decimal](18, 0) NULL,
[PeriodOfsession] [nvarchar](50) NULL,
[DescriptionOfSession] [nvarchar](max) NULL,
[LabTestID] [nvarchar](50) NULL,
[XaryTestID] [nvarchar](50) NULL,
[MedisionName] [nvarchar](50) NULL,
[InjuctionName] [nvarchar](50) NULL,
[Others] [nvarchar](max) NULL,
[NotesAr] [nvarchar](max) NULL,
[NotesEng] [nvarchar](max) NULL,
[NumOfVisit] [int] NULL,
CONSTRAINT [PK_Sessions] PRIMARY KEY CLUSTERED
(
[SessionID] 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].[Sessions] ADD CONSTRAINT [DF_Sessions_NumOfVisit] DEFAULT ((1)) FOR [NumOfVisit]
GO
------------------
be side it i have rate table
MCID int
Rate Decimal
----------------------
what i need??
seeions table has these fields
[SessionFees]
[MCFees]
[DoctorFees]
[AppFees]
wanna when user enter seeion fees the other three columns be auto compouted
like this
[MCFees]=[SessionFees]*Rate from table rate/100
[DoctorFees]=[SessionFees]*Rate from table rate/100
[AppFees]=[SessionFees]*Rate from table rate/100
need to finish this as soon as possible
Reply
Answers (
7
)
Creating a table in SQL using values of two table with some
divide by zero error encountered