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
 need help...

Author  Topic 

GaneshRamanan
Starting Member

40 Posts

Posted - 2011-01-10 : 00:53:36
insert into ##TmpScheduleDetail Exec [OPM].[Appointmentextend] @DoctorID,@AppointmentDate,@FromTime,@ToTime where @fromtime not between starttime and startime

can i restrict it before inputing into the table if starttime returns multiple value

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-01-10 : 02:07:46
what is the starttime? is it what you are pointing to @FromTime? If so, please note that a variable can only hold one value at a time. and can never be assigned with multiple values. Any how you can bound the execution of the required statements via If... e.g.

IF (@FromTime is not null and @Fromtime >...)
Begin
insert into ...
Exec ....
....
End
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-10 : 10:56:09
you need to use second method below for that

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

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

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-01-10 : 11:00:46
i assume you know the consequences of using ## tables especially when code is executed parallely

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

Go to Top of Page
   

- Advertisement -