﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by Pedro Lopes  / Check Availability Window - SQL2k5 / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 16:23:07 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Check Availability Window - SQL2k5</title><link>http://www.sqlservercentral.com/Forums/Topic416870-896-1.aspx</link><description>Thanks for the script. This will save some of our precious time :)</description><pubDate>Tue, 22 Jan 2008 01:55:07 GMT</pubDate><dc:creator>Lars Søe Mikkelsen</dc:creator></item><item><title>RE: Check Availability Window - SQL2k5</title><link>http://www.sqlservercentral.com/Forums/Topic416870-896-1.aspx</link><description>Sorry all, i had noticed it and submited it together with the above changes, but forgot to mention them... Change all 'dba_database' with 'msdb' until the edited version is approved and published. :ermm:</description><pubDate>Fri, 11 Jan 2008 08:05:57 GMT</pubDate><dc:creator>Pedro Lopes MS</dc:creator></item><item><title>RE: Check Availability Window - SQL2k5</title><link>http://www.sqlservercentral.com/Forums/Topic416870-896-1.aspx</link><description>I had to remove 'dba_database.' (3x) from the script after applying your changes to make it work.</description><pubDate>Fri, 11 Jan 2008 06:05:27 GMT</pubDate><dc:creator>Paul Sturm</dc:creator></item><item><title>RE: Check Availability Window - SQL2k5</title><link>http://www.sqlservercentral.com/Forums/Topic416870-896-1.aspx</link><description>Looks like some of the indentation i made in the online editor when submiting broke the script. I resubmited it.Look for:SELECT @datestr = CONVERT(NVARCHAR(4), @year) + N''-'' + CONVERT(NVARCHAR(2), @month) + N''-'' + CONVERT(NVARCHAR(4), @day) + N'' '' +REPLACE(CONVERT(NVARCHAR(2), @hour) + N'':'' + CONVERT(NVARCHAR(2), @min) + N'':'' + CONVERT(NVARCHAR(2), @sec), '' '', ''0'')and change it to:SELECT @datestr = CONVERT(NVARCHAR(4), @year) + N''-'' + CONVERT(NVARCHAR(2), @month) + N''-'' + CONVERT(NVARCHAR(4), @day) + N'' '' + REPLACE(CONVERT(NVARCHAR(2), @hour) + N'':'' + CONVERT(NVARCHAR(2), @min) + N'':'' + CONVERT(NVARCHAR(2), @sec), '' '', ''0'')Also looks for:SELECT @startdate = DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0) - 30, @enddate = DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), @numdays = DATEDIFF(DAY,@startdate,@enddate)and change it to:SELECT @startdate = DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0) - 30, @enddate = DATEADD(dd, DATEDIFF(dd, 0, GETDATE())[b], 0)[/b], @numdays = DATEDIFF(DAY,@startdate,@enddate);)About msdb.dbo.sysschedules, check BOL (Contains information about SQL Server Agent job schedules. This table is stored in the msdb database.), it's there - on SQL 2005, as i've told this script is only compatible with SQL 2k5.Also available for 2000 here, with some diferences: http://www.sqlservercentral.com/scripts/Maintenance+and+Management/61431/I also resubmited it because of indentation mistakes.</description><pubDate>Fri, 11 Jan 2008 04:12:10 GMT</pubDate><dc:creator>Pedro Lopes MS</dc:creator></item><item><title>RE: Check Availability Window - SQL2k5</title><link>http://www.sqlservercentral.com/Forums/Topic416870-896-1.aspx</link><description>There is also a problem with the msdb.dbo.sysschedules table that doesn't exist</description><pubDate>Fri, 11 Jan 2008 01:27:04 GMT</pubDate><dc:creator>devvw</dc:creator></item><item><title>RE: Check Availability Window - SQL2k5</title><link>http://www.sqlservercentral.com/Forums/Topic416870-896-1.aspx</link><description>I get an "Incorrect syntax near '='." when executing the scriptIt looks like the problem is located in the @numdays=DATEDIFF.... part but can figure out the solutionSELECT 	@startdate = DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0) - 30, @enddate =   DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), @numdays = DATEDIFF(DAY,@startdate,@enddate))</description><pubDate>Fri, 11 Jan 2008 01:00:21 GMT</pubDate><dc:creator>devvw</dc:creator></item><item><title>Check Availability Window - SQL2k5</title><link>http://www.sqlservercentral.com/Forums/Topic416870-896-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/Maintenance+and+Management/61434/"&gt;Check Availability Window - SQL2k5&lt;/A&gt;[/B]</description><pubDate>Tue, 30 Oct 2007 23:03:15 GMT</pubDate><dc:creator>Pedro Lopes MS</dc:creator></item></channel></rss>