SQL
USE [PrintMonitor]
GO
/****** Object:  StoredProcedure [dbo].[Printer_Properties]    Script Date: 10/15/2008 21:21:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Printer_Properties]
	(
		@Servername varchar(255),
		@PrinterName varchar(255)
	)
AS
	
	SELECT TOP 5 p.Name, 
	             isnull(p.Location,'') As Location,
	             isnull(p.Comment,'') As Comment,
	             isnull(p.Monitor,0) As Monitor,
	             isnull(j.[Document Name], '') As [Document Name],
	             isnull(j.[User Name], '') As [User Name],
	             isnull(j.[Pages Printed],0) As [Pages Printed]
	      FROM dbo.[Printers] p LEFT JOIN dbo.[Print Jobs] j
	        ON p.Id = j.[Printer Id]
	      WHERE p.Name = @PrinterName
	        AND p.[Server Name] = @Servername
	      ORDER BY j.Submitted DESC
	             
	
	RETURN 

Last edited Oct 15, 2008 at 8:21 PM by Merrion, version 1

Comments

No comments yet.