Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

add approve data column in sp

$
0
0

i want to add approve date from approval table i tried but it not works

sp

ALTER procedure [dbo].[spdocuments]
as
SELECT    dbo.DocumentInfo.DocID as DocumentID,
dbo.DocumentInfo.DocName as DocumentName,
dbo.DocumentInfo.UploadedDate as UploadedDate ,
  dbo.DocumentInfo.Uploadfile as FileUploaded,
    dbo.DocumentInfo.UploadedBy as  UploadedBy,
    dbo.Department.DepType as Department,
    dbo.Approval.ApproveDate,
 dbo.ApproveType.ApproveType as Status

FROM         dbo.DocumentInfo inner JOIN
                      dbo.ApproveType ON dbo.DocumentInfo.ApproveID = dbo.ApproveType.ApproveID inner JOIN
                      dbo.Department ON dbo.DocumentInfo.DepID = dbo.Department.DepID left join
                      dbo.Approval on dbo.Approval.ApproveID = dbo.Approval.ApproveDate

this sp returns me approve date column null like this

DocumentID	DocumentName	UploadedDate	          FileUploaded	       UploadedBy	Department	ApproveDate	Status
30	      computer science 	2013-12-25 18:31:26.420	dotnetcodes.docx	noreen	     Computer Science	NULL	   Pending
31	          manual hr	2013-12-26 12:16:54.830	The Business Memo.doc	kulsoom	       Human Resource	NULL	     Approve

whereas in approval table and in this approvedate data exist

SeqNO   DocID   ApproveID  AppoveBy DesigID          ApproveDate
258	30	1	    sundus	1	      2013-12-25 18:34:47.347
259	30	1	    kaneez	2	     2013-12-25 18:34:47.347
260	31	1	     wajihazeb	3	   2013-12-26 12:17:37.150


Viewing all articles
Browse latest Browse all 23857

Trending Articles