Print ''
Print '----------------------------------------------------'
Print ' Delete Date Only to be used when cutomised:'
Print ' FirstRevision: V2.0.0   26.06.2012 14:19'
Print ' Autor        : J.Feuerstein'
Print ' '
Print ' Database Name: #DB_N#'
Print '----------------------------------------------------'
GO

USE [#DB_N#]


print 'ObjectPacket_SQL_CommandText_GenFor_JobDef:'

SELECT TOP 1 *

FROM dbo.Objects_tbl with (nolock)

where

 Objects_tbl.ObjectClass='DS'

 AND Objects_tbl.ProcStateCol03 = 'RUN'

 AND Objects_tbl.ObjectFromSiteID = 'test04'

 And Objects_tbl.ObjectOwningSiteID='test04'

 And Objects_tbl.ObjectUgMaster_Type = 'AP'

 AND Objects_tbl.ObjectType = 'UGMASTER'

 And  Objects_tbl.ObjectUgMaster_CompCount<=10000

 And  Objects_tbl.ObjectUgMaster_CompCount>=0

 AND (Objects_tbl.ObjectName LIKE 'MC-AUTO%')

 ORDER BY

 Objects_tbl.ObjectUgMaster_APLevels ASC,

 Objects_tbl.ObjectUgMaster_CompCount ASC, Objects_tbl.ObjectLastModDate DESC

GO

Print ''
Print '----------------------------------------------------'
Print ' SQL Script Excetuted on: [#DB_N#]'
Print '----------------------------------------------------'
GO
