SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Count number of visits by week, ending on Saturday


Count number of visits by week, ending on Saturday

Author
Message
NineIron
NineIron
SSC Eights!
SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)

Group: General Forum Members
Points: 817 Visits: 653
I am trying to get a count of visits by week with the week ending on Saturday. My problem is getting the count to start on the first day of the month and end on the last day of the month. So, in the data provided, it should look like this.....
I also included the code to create a Calendar table. The code for the calendar was supplied by this forum.


3/2/2013 3/9/2013 3/16/2013 3/23/2013 3/30/2013 3/31/2013
12 20 47 55 22 0






create table Visits
(
MRN varchar(10),
SchedProv varchar(50),
ApptDt2 datetime,
VisitType varchar(10)
)

insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00044999','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00001724','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('785444','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('751229','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('759859','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('734041','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00500405','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('761328','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('786448','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861823','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00546686','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00625883','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00360723','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861496','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00053157','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('840426','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('803846','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00520938','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('761171','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('852069','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('328194','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00593430','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00516848','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('753541','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00108154','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00126417','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00029901','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00627830','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00562954','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('696010','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('765594','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('845976','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00104297','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00092110','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('707406','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00565956','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('743346','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00588900','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00121731','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00056537','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00378582','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00000575','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00603826','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00120478','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('844102','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('331427','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00051696','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00538642','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('771090','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('693655','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00005482','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('855161','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00559069','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('846759','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('737714','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('698712','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00585124','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('831352','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00058411','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('718979','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('802643','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('678904','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00622960','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00549645','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('857410','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('726198','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('855148','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('727006','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00092747','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00532457','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('665884','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('720278','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00510940','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('712845','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('663168','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00007244','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('826229','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00611974','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00066879','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('794126','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('087155','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00605167','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('340509','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861855','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00588218','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00619095','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00014292','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00599619','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00521141','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('726198','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('779716','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('706899','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('862442','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00053817','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00547709','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00121795','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00537475','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00122094','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00503702','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('697260','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00074082','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('337766','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00006862','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('768686','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00547362','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00504664','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('707406','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00016247','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('837784','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00533346','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00042183','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('747814','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00025299','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00017372','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00588185','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('761328','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00068902','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('825164','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00111070','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00101789','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('680568','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00017154','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('726837','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('346376','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00078071','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00056451','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861823','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('783502','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('805628','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00532457','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('802126','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00557398','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('841602','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00027459','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00016729','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00122094','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00013788','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00040832','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('774855','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('730596','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('844524','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00000575','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861584','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00623818','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('796700','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('783502','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('822339','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00506708','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00619095','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('774203','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('653249','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('760872','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('724820','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00040905','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('765594','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('087155','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00582613','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00010173','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('697264','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00035143','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('804973','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('325149','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('768446','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('855161','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00051237','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('732545','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')


SELECT TOP 60000 IDENTITY(INT, 1, 1) AS N
INTO dbo.Tally
FROM sys.all_columns ac1
CROSS JOIN sys.all_columns ac2
CROSS JOIN sys.all_columns ac3

ALTER TABLE dbo.Tally ADD CONSTRAINT PK_Tally_N PRIMARY KEY CLUSTERED (N) WITH FILLFACTOR = 100

SET DATEFORMAT YMD

DECLARE @Date_Start AS DATETIME
DECLARE @Date_End AS DATETIME

SET @Date_Start = '2000-01-01'
SET @Date_End = '2020-12-31'


CREATE TABLE dbo.Calendar
(
calendar_date_ID INT IDENTITY(1, 1) NOT NULL,
calendar_week_ID INT,
calendar_date DATETIME PRIMARY KEY CLUSTERED,
calendar_year SMALLINT,
calendar_month TINYINT,
calendar_day TINYINT,
calendar_quarter TINYINT,
first_day_in_month DATETIME,
last_day_in_month DATETIME,
day_of_week TINYINT,
week_of_year TINYINT,
days_in_month TINYINT,
day_of_year SMALLINT,
is_weekday INT,
day_name VARCHAR (10),
month_name VARCHAR (10),
iso_date CHAR (8),
fiscal_year SMALLINT,
fiscal_month TINYINT
);

INSERT INTO dbo.Calendar
(calendar_date)
SELECT t.N - 1 + @Date_Start
FROM dbo.Tally t
WHERE t.N - 1 + @Date_Start <= @Date_End

UPDATE dbo.Calendar
SET calendar_week_ID = calendar_date_id / 7 + 1,
calendar_year = Datepart (YEAR, calendar_date),
fiscal_year = CASE
WHEN Datepart(M, calendar_date) >= 10 THEN Datepart (YEAR, calendar_date) + 1
ELSE Datepart (YEAR, calendar_date)
END,
calendar_month = Datepart (MONTH, calendar_date),
fiscal_month = CASE
WHEN Datepart(M, calendar_date) >= 10 THEN Datepart(M, calendar_date) - 9
ELSE Datepart(M, calendar_date) + 3
END,
calendar_day = Datepart (DAY, calendar_date),
calendar_quarter = Datepart (QUARTER, calendar_date),
first_day_in_month = Dateadd(mm, Datediff(mm, 0, calendar_date), 0),
last_day_in_month = Dateadd(mm, Datediff(mm, 0, calendar_date) + 1, 0) - 1,
day_of_week = Datepart (WEEKDAY, calendar_date),
week_of_year = Datepart (WEEK, calendar_date),
day_of_year = Datepart (DAYOFYEAR, calendar_date),
is_weekday = Isnull (( CASE
WHEN ( ( @@DATEFIRST - 1 ) + ( Datepart (WEEKDAY, calendar_date) - 1 ) )%7 NOT IN ( 5, 6 )
THEN 1
END ), 0),
day_name = Datename (WEEKDAY, calendar_date),
month_name = Datename (MONTH, calendar_date),
iso_date = CONVERT(CHAR(8), calendar_date, 112),
days_in_month = Datepart(dd, ( Dateadd(mm, Datediff(mm, 0, calendar_date) + 1, 0) - 1 ))

SELECT TOP 1000 *
FROM dbo.Calendar


davidandrews13
davidandrews13
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1064 Visits: 4542
this is what i got.
not sure how to pivot the info to how you want it though, as the weekCommencing is not known from the start.



SELECT DISTINCT
--[WeekNumber],
COUNT(weekNumber) OVER (PARTITION BY [WeekNumber]) AS CountWeekNum ,
WeekCommencing = DATEADD(DAY,((DATEPART(w,[y].ApptDt2))-1)* -1,[y].ApptDt2)
FROM (
SELECT
WeekNumber = DATEPART(week,[v].[ApptDt2]) ,
[v].[ApptDt2]
FROM visits [v]
)y
ORDER BY WeekCommencing


NineIron
NineIron
SSC Eights!
SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)

Group: General Forum Members
Points: 817 Visits: 653
Thanx but, I need the week ending on Saturday, not WeekCommencing on Sunday, or if the last day of the month is after the last Saturday then, that day would be the "week ending" date. So, in our example, the last Saturday is March 30th. I need the "week ending" date to be March 31st.
NineIron
NineIron
SSC Eights!
SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)

Group: General Forum Members
Points: 817 Visits: 653
Also, the count of visits begins on the first day of the month and ends on the last day. If this is too complicated for this forum, I understand.
J Livingston SQL
J Livingston SQL
SSCertifiable
SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)

Group: General Forum Members
Points: 5435 Visits: 35347
NineIron (4/16/2013)
I am trying to get a count of visits by week with the week ending on Saturday. My problem is getting the count to start on the first day of the month and end on the last day of the month.


what do you want to happen when a week spans a month end?
the sample data is only for a single month?

as a starter....one of many methods



SELECT COUNT(MRN) AS visits, DATEADD(day, 6 - DATEDIFF(day, 6, ApptDt2) % 7, ApptDt2) AS WE
FROM Visits
GROUP BY DATEADD(day, 6 - DATEDIFF(day, 6, ApptDt2) % 7, ApptDt2)




you then need to probably use dynamic cross tabs....search under Authors>Jeff Moden for a couple of very good articles

edit...to use a calendar table, I would suggest you preload the calendar with your relevant weekending dates

links to the relevant articles on this forum

http://www.sqlservercentral.com/articles/T-SQL/63681/

http://www.sqlservercentral.com/articles/Crosstab/65048/

________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day

NineIron
NineIron
SSC Eights!
SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)

Group: General Forum Members
Points: 817 Visits: 653
I'll take a peek at the articles but, to answer your question. I need to count the number of visits by the weeks in the month. If the month starts on Tuesday then, the week would go from Tuesday to Saturday. If the month ends on a day other than Saturday then, that would be the last day of counting visits for that week.
NineIron
NineIron
SSC Eights!
SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)

Group: General Forum Members
Points: 817 Visits: 653
Pardon my ignorance but, what does the % 7 do in the DATEADD(day, 6 - DATEDIFF(day, 6, ApptDt2) % 7, ApptDt2)?
Also, I read the articles about cross tabs. Very slick. I'm still at a loss of how to get the number of weekly visits, considering that the date range must start at the first day of the month and end at the last day.
Any thoughts?

The data generated from the code below contains February and March, 2013.


create table Visits
(
MRN varchar(10),
SchedProv varchar(50),
ApptDt2 datetime,
VisitType varchar(10)
)

insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('803281','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00518676','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('764215','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('653978','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('771090','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('309607','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00027256','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('321436','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00124841','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('800924','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00532449','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('777703','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('736567','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00041014','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('790759','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00125158','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('689215','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00609575','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00014292','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('694922','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('846625','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00381764','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('850102','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00045288','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('765097','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('843704','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00122498','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00006407','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('803281','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00519483','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00053157','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('329408','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('810577','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('680568','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('761171','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('663263','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('802082','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00078071','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('328194','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('810412','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('860757','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00120114','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('775909','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00523485','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861442','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('822339','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00120215','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00634674','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('654519','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('678904','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00514722','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00005482','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('647827','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00509864','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('327088','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('844428','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('810811','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00547362','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('769322','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('806455','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('760428','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00580827','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00092747','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00121795','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00074526','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('732545','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00101340','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00549645','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00125158','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('766904','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00044631','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('214811','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('841986','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00108274','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('755330','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('848974','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('761328','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('806227','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00017372','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('660526','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00045288','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('806706','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00053817','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('341556','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00537469','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('822339','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861823','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00112158','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00508639','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('810277','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('337766','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('702733','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00514305','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('322995','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('753541','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('795937','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('852069','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('676253','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00109434','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861584','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('845976','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('683920','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('673837','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('654519','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('760872','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00532457','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('730159','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00104619','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00116438','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00627296','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00582613','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00511072','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('325149','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('859277','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('322735','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00601791','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('758991','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('666341','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('806022','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00122498','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('822339','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('729054','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('676253','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('845976','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00559069','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00078071','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00522034','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('734833','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00504664','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('712845','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00585124','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00376923','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('754293','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00048686','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('668524','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00573712','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00599619','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00538642','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('847964','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00042864','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('792081','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00557398','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('841602','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00027459','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00016729','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00122094','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00013788','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00040832','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('774855','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('730596','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('844524','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00000575','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861584','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00623818','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('796700','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('783502','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('822339','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00506708','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00619095','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00360723','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861496','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00053157','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('840426','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('803846','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00520938','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('761171','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('852069','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('328194','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00593430','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00516848','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('753541','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-07 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00108154','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00126417','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00029901','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00627830','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00562954','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('696010','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('765594','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('845976','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00104297','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00092110','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('707406','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00565956','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('743346','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00588900','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00121731','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00056537','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00378582','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00000575','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00603826','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00120478','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('844102','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('331427','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00051696','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00538642','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-14 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('771090','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('693655','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00005482','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('855161','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00559069','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('846759','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('737714','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('698712','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00585124','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('831352','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00058411','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('718979','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('802643','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('678904','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00622960','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00549645','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('857410','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('726198','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('855148','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('727006','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00092747','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00518073','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861442','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('787977','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('661504','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00574741','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('847682','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('692928','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('768686','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('846759','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('715513','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00378582','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('654519','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('776827','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00588218','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00110003','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('757181','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('220294','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00539927','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00354889','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00511072','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00597487','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-05 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00580827','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-08 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861496','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-08 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00050274','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-08 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00010883','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-08 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00579587','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-08 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00582649','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-08 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00547709','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-08 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('662552','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-08 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('683920','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-08 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('716066','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00515030','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('653978','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00047624','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('718979','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('643265','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00122354','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00013788','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('737250','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('790689','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00549645','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('726198','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00058716','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00084098','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('665884','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('715601','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00106568','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00065141','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00557653','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('722105','KELLEY-HEDGEPETH M.D.,ALYSON','2013-02-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00044999','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00001724','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('785444','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('751229','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('759859','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('734041','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00500405','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('761328','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('786448','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861823','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00546686','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00625883','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-01 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('720278','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00510940','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('712845','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('663168','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00007244','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('826229','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00611974','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00066879','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('794126','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('087155','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00532457','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('665884','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-15 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('779716','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('706899','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('862442','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00053817','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00547709','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00121795','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00537475','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00122094','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00503702','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('697260','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00074082','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('337766','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00006862','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('768686','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00547362','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00504664','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('707406','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00016247','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('837784','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-21 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('774203','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('653249','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('760872','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('724820','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00040905','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('765594','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('087155','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00582613','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00010173','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('697264','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00035143','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('804973','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('325149','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('768446','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('855161','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00051237','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('732545','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-22 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00533346','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00042183','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('747814','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00025299','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00017372','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00588185','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('761328','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00068902','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('825164','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00111070','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00101789','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('680568','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00017154','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('726837','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('346376','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00078071','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00056451','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861823','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('783502','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('805628','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00532457','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('802126','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-28 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00605167','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('340509','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('861855','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','CON')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00588218','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00619095','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00014292','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00599619','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('00521141','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')
insert into Visits(MRN, SchedProv, ApptDt2, VisitType) values('726198','KELLEY-HEDGEPETH M.D.,ALYSON','2013-03-19 00:00:00.000','OVT')



Lynn Pettis
Lynn Pettis
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39142 Visits: 38519
Pardon my ignorance but, what does the % 7 do in the DATEADD(day, 6 - DATEDIFF(day, 6, ApptDt2) % 7, ApptDt2)?


In this case the % is the modulo operator. It is returning the remainder of the value DATEADD(day, 6 - DATEDIFF(day, 6, ApptDt2) divided by 7. This value will be a number between 0 and 6.


Here is a link to the MSDN entry for Modulo:

http://msdn.microsoft.com/en-us/library/ms190279(v=sql.100).aspx

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
J Livingston SQL
J Livingston SQL
SSCertifiable
SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)SSCertifiable (5.4K reputation)

Group: General Forum Members
Points: 5435 Visits: 35347
an idea to get you started



SELECT COUNT(MRN) AS visits,
DATEPART(MONTH, ApptDt2) AS monthno,
DATEADD(day, 6 - DATEDIFF(day, 6, ApptDt2) % 7, ApptDt2) AS WE
FROM Visits
GROUP BY
DATEPART(MONTH, ApptDt2),
DATEADD(day, 6 - DATEDIFF(day, 6, ApptDt2) % 7, ApptDt2)




________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day

NineIron
NineIron
SSC Eights!
SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)SSC Eights! (817 reputation)

Group: General Forum Members
Points: 817 Visits: 653
Thanx.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search