Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Urgent help!!!

Author  Topic 

GaneshRamanan
Starting Member

40 Posts

Posted - 2011-01-12 : 05:58:42
sp 1

[OPM].[AppointmentExtend](@DoctorID Varchar(5),@AppointmentDate Datetime,@FromTime datetime,@ToTime Datetime)


opm.appointmentextend fromtime totime appointmenttime

2011-01-12 11:03 2011-01-12 11:06 1900-01-01 00:03:00

doing computation in this sp to split fromtime, totime, based on appointmenttime

sp 2
[OPM].[appointmentExtension](@doctorid Varchar(5),@appointmentdate datetime,@specialistid int,@fromtime datetime,@totime datetime,@userid bigint)

Create table #TmpScheduleDetail(ID int ,FromTime datetime,AppointmentTime datetime,ToTime datetime,Status varchar(5));
insert into #TmpScheduleDetail Exec [OPM].[AppointmentExtend] @DoctorID,@AppointmentDate,@FromTime,@ToTime


SP2 Insert the values into the Appointment tables

SP1 RETURNS VALUES TO THE SP2
SP2 INSERT THOSE VALUES INTO TABLES

but i m getting fromtime, totime in sp2

SP2 passes the values to the SP1

I want to restrict the values which is already inserted into the appointment tables


for eg:

11:00 to 12:00 if it is already inserted into the appointment table

i dont want to insert into again.

can you please tell me the condition?

Thanks in advance,
Ganesh

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-12 : 08:35:52
you need to use method 2 below with WHERE condition

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx

the WHERE condition will be like

WHERE NOT EXISTS (SELECT 1 FROM #TmpScheduleDetail WHERE FromTime = @FromTime AND ToTime =@ToTime)


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-12 : 08:36:38
ah duplicate. please dont cross post

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=155133

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -