Click here to Skip to main content
15,914,221 members
Home / Discussions / Database
   

Database

 
GeneralRe: Help needed for an user defined Function Pin
Exelioindia9-Jul-07 23:02
Exelioindia9-Jul-07 23:02 
AnswerRe: Help needed for an user defined Function Pin
gauthee9-Jul-07 23:26
gauthee9-Jul-07 23:26 
QuestionRight Outer Join Probs... Pin
Member 38798819-Jul-07 20:19
Member 38798819-Jul-07 20:19 
QuestionPassing an array to stored procedures Pin
M. J. Jaya Chitra9-Jul-07 18:40
M. J. Jaya Chitra9-Jul-07 18:40 
AnswerRe: Passing an array to stored procedures Pin
Sathesh Sakthivel9-Jul-07 19:16
Sathesh Sakthivel9-Jul-07 19:16 
QuestionQuery Insert Date? Pin
Vodstok9-Jul-07 16:14
Vodstok9-Jul-07 16:14 
AnswerRe: Query Insert Date? Pin
Frank Kerrigan16-Jul-07 2:32
Frank Kerrigan16-Jul-07 2:32 
QuestionQuery probs............., Pin
Member 38798819-Jul-07 3:36
Member 38798819-Jul-07 3:36 
Hi the follwing procedure i am getting a month all dates...,
In that i am using my own query for the select statement place...,
I used left outer join to show all the dates of @tbl_date...,
But it's displaying only What are the dates i am having in tblMonthhourdetails table those dates only...,
But i want to display all the dates of that month and if the @tbl_date table dates and tbltimecardmain and tblmonthhourdetails dates are matchable those records also want to display...,
Else if there's is no matachable date in that timecardmain table and month hour details table those date place it want to show null
...,
I pasted my query on here,
I tried with all joins but i didnt get answer...,
Plz hlp me how to do that...,

Stored procedure:

DECLARE @startDate datetime
declare @nextdate datetime
DECLARE @endDate datetime
declare @tbl_date table (mydate datetime)
set nocount on
SET @startDate = CAST( CAST( 2007 AS varchar(4) ) + '0101' AS datetime )
SET @startDate = DATEADD( m, 6 - 1, @startDate )
set @enddate=dateadd(m,1,@startdate)
while @startdate < @enddate
begin
--SET @nextdate = DATEADD( d, 0, @startdate )
insert into @tbl_date values (@startdate)
set @startdate=dateadd(d,1,@startdate)
end

SELECT EM.empId as EId, EM.empName as EName,ttd.mydate,
TC.shift,PM.location,TC.reportingtime as FromTime, TC.leavingtime as ToTime,
MHD.AppWHours as Reg,MHD.AppOtHours as Ot,MHD.AppSHours as SReg,
MHD.AppSOtHours as SOt,SD.Whrs
FROM dbo.tblEmployeeMaster EM INNER JOIN dbo.tblTimeCardmain TC ON EM.empId = TC.empid
left outer join @tbl_date ttd on ttd.mydate=TC.carddate
left outer JOIN dbo.tblMonthHourDetails MHD ON (ttd.mydate = MHD.SDate
and TC.empid = MHD.EmpId)

--order by EM.empid,ttd.mydate
INNER JOIN dbo.tblProjectMaster PM ON TC.projectid = PM.projectID
INNER JOIN dbo.tblsalarydetails SD ON MHD.EmpId = SD.EmpID
where EM.empid=213 and datepart(mm,Ttd.mydate)=6 and
datepart(yyyy,ttd.mydate)=2007
order by ttd.mydate







Regards,
Magi

AnswerRe: Outer join problem Pin
andyharman9-Jul-07 6:49
professionalandyharman9-Jul-07 6:49 
GeneralRe: Outer join problem Pin
Member 38798819-Jul-07 19:07
Member 38798819-Jul-07 19:07 
Questionhow to connect a database in sql with vb6 application Pin
treem jone9-Jul-07 1:42
treem jone9-Jul-07 1:42 
AnswerRe: how to connect a database in sql with vb6 application Pin
Pete O'Hanlon9-Jul-07 1:48
mvePete O'Hanlon9-Jul-07 1:48 
AnswerRe: how to connect a database in sql with vb6 application Pin
Sven Cipido9-Jul-07 20:23
Sven Cipido9-Jul-07 20:23 
QuestionCreation of table Pin
Ashish Vohra9-Jul-07 1:33
Ashish Vohra9-Jul-07 1:33 
AnswerRe: Creation of table Pin
SHatchard9-Jul-07 2:02
SHatchard9-Jul-07 2:02 
AnswerRe: Creation of table Pin
sam#9-Jul-07 2:05
sam#9-Jul-07 2:05 
AnswerRe: Creation of table Pin
Krish - KP9-Jul-07 2:11
Krish - KP9-Jul-07 2:11 
QuestionBackup or restore Pin
jaics2629-Jul-07 0:46
jaics2629-Jul-07 0:46 
AnswerRe: Backup or restore Pin
Paul Conrad13-Jul-07 11:54
professionalPaul Conrad13-Jul-07 11:54 
QuestionProblem inserting data in SQL Server 2000 Pin
Mubashir Javaid8-Jul-07 22:12
Mubashir Javaid8-Jul-07 22:12 
AnswerRe: Problem inserting data in SQL Server 2000 Pin
Rajesh Mascon8-Jul-07 23:22
Rajesh Mascon8-Jul-07 23:22 
Questionhousekeeping Blobs. [modified] Pin
gloffa8-Jul-07 21:39
gloffa8-Jul-07 21:39 
QuestionSQL Server 2000 connection problem Pin
Deteroc8-Jul-07 21:31
Deteroc8-Jul-07 21:31 
AnswerRe: SQL Server 2000 connection problem Pin
Nouman Bhatti8-Jul-07 21:57
Nouman Bhatti8-Jul-07 21:57 
Questiondisplay stored procedure format..........., Pin
Member 38798818-Jul-07 21:16
Member 38798818-Jul-07 21:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.