CREATE TABLE #tempconsolINFO

(

 Cntlname NVARCHAR(250)

 ,currenttime NVARCHAR(250)

)

INSERT INTO #tempconsolINFO

EXEC sp_MSforeachdb

BEGIN

 USE ?;

 SELECT DB_NAME(),datetime from temp

 where datetime between ”2010-01-31 07:25:04.493” and ”2010-02-23 07:38:44.010”

END’

select * from #tempconsolINFO;

Advertisements