<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cogniza &#187; SQL</title>
	<atom:link href="http://cogniza.com/wordpress/category/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://cogniza.com/wordpress</link>
	<description>Business-Intelligence Specialists</description>
	<lastBuildDate>Sat, 30 Apr 2011 13:22:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SQL Server: Date Arithmetic</title>
		<link>http://cogniza.com/wordpress/2009/11/05/sql-server-date-arithmetic/</link>
		<comments>http://cogniza.com/wordpress/2009/11/05/sql-server-date-arithmetic/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 02:32:24 +0000</pubDate>
		<dc:creator>Craig Buchanan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[Date]]></category>
		<category><![CDATA[T-SQL]]></category>

		<guid isPermaLink="false">http://www.cogniza.com/blog/?p=106</guid>
		<description><![CDATA[Useful, dynamically-generated dates for SQL Server.

--[1st day  of current month]: use the GetDate(), Month(), and Year() functions to determine the current month and year.   Build a string using these values in MM/01/YYYY format.  Convert the String to DateTime.
 CAST( CAST( Month(GetDate()) AS Char(2) ) + '/01/' + CAST( Year(GetDate()) AS Char(4)) [...]]]></description>
			<content:encoded><![CDATA[<p>Useful, dynamically-generated dates for SQL Server.<span id="more-106"></span><br />
<code><br />
--[1st day  of current month]: use the GetDate(), Month(), and Year() functions to determine the current month and year.   Build a string using these values in MM/01/YYYY format.  Convert the String to DateTime.<br />
 CAST( CAST( Month(GetDate()) AS Char(2) ) + '/01/' + CAST( Year(GetDate()) AS Char(4)) AS DateTime)<br />
</code><code><br />
--[Last day of current month]: add a month to [1st day of current month], then subtract a day.<br />
DateAdd(m, 1, CAST( CAST( Month(GetDate()) AS Char(2) ) + '/01/' + CAST( Year(GetDate()) AS Char(4)) AS DateTime)) -1<br />
</code><code><br />
--[1st day of prior month]: subtract a month from [1st day of current month].<br />
DateAdd(m, -1, CAST( CAST( Month(GetDate()) AS Char(2) ) + '/01/' + CAST( Year(GetDate()) AS Char(4)) AS DateTime))<br />
</code><code><br />
--[Last day of prior month]:  subtract a day from [1st day of current month].<br />
CAST( CAST( Month(GetDate()) AS Char(2) ) + '/01/' + CAST( Year(GetDate()) AS Char(4)) AS DateTime) -1<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://cogniza.com/wordpress/2009/11/05/sql-server-date-arithmetic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server: Create a Table of Dates</title>
		<link>http://cogniza.com/wordpress/2006/04/27/sql-server-create-a-table-of-dates/</link>
		<comments>http://cogniza.com/wordpress/2006/04/27/sql-server-create-a-table-of-dates/#comments</comments>
		<pubDate>Thu, 27 Apr 2006 13:27:18 +0000</pubDate>
		<dc:creator>Craig Buchanan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.cogniza.com/blog/?p=36</guid>
		<description><![CDATA[This Sql Server script will create a function that returns all dates in a date range as a table.]]></description>
			<content:encoded><![CDATA[<p>This Sql Server script will create a function that returns all dates in a date range as a table.</p>
<p><span id="more-36"></span></p>
<p><code> CREATE FUNCTION dbo.DateTable (<br />
@StartDate smalldatetime,<br />
@EndDate smalldatetime)<br />
RETURNS @DatesTable TABLE (DateCol smalldatetime)<br />
AS<br />
WHILE @StartDate < = @EndDate<br />
BEGIN<br />
INSERT INTO @DatesTable (DateCol)<br />
VALUES (@StartDate)<br />
SET @StartDate = DateAdd(dd,1,@StartDate)<br />
END<br />
RETURN<br />
END<br />
GO<br />
GRANT SELECT ON dbo.DateTable TO PUBLIC<br />
GO </code></code></p>
]]></content:encoded>
			<wfw:commentRss>http://cogniza.com/wordpress/2006/04/27/sql-server-create-a-table-of-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle: Object Dependencies</title>
		<link>http://cogniza.com/wordpress/2005/11/20/oracle-object-dependencies/</link>
		<comments>http://cogniza.com/wordpress/2005/11/20/oracle-object-dependencies/#comments</comments>
		<pubDate>Mon, 21 Nov 2005 00:22:24 +0000</pubDate>
		<dc:creator>Craig Buchanan</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[PL/SQL]]></category>

		<guid isPermaLink="false">http://www.cogniza.com/blog/?p=28</guid>
		<description><![CDATA[SQL query that lists Oracle views and functions and the functions and tables that are contained in them.]]></description>
			<content:encoded><![CDATA[<p>This article demonstrates a SQL query that lists Oracle views and functions and the functions and tables that are contained in them.</p>
<p><span id="more-28"></span> <code><br />
SELECT  OBJECT_TYPE,OWNER,NAME<br />
,REFERENCED_TYPE REF_OBJECT_TYPE<br />
,REFERENCED_OWNER REF_OWNER<br />
,REFERENCED_NAME REF_NAME<br />
FROM	ALL_DEPENDENCIES<br />
WHERE	TYPE IN ('VIEW','FUNCTION')	--show views and functions<br />
--show the functions and tables that they contain<br />
AND	REFERENCED_TYPE IN ('FUNCTION','TABLE')<br />
ORDER BY 1,2,3;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://cogniza.com/wordpress/2005/11/20/oracle-object-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle: Find column or table query</title>
		<link>http://cogniza.com/wordpress/2005/10/26/oracle-find-column-or-table/</link>
		<comments>http://cogniza.com/wordpress/2005/10/26/oracle-find-column-or-table/#comments</comments>
		<pubDate>Wed, 26 Oct 2005 18:26:18 +0000</pubDate>
		<dc:creator>Craig Buchanan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.cogniza.com/blog/?p=5</guid>
		<description><![CDATA[Search all Oracle tables for a specific column or table name.]]></description>
			<content:encoded><![CDATA[<p>Search all Oracle tables for a specific column or table name.</p>
<p><span id="more-5"></span><code><br />
--Remove the comment for the appropriate restriction.<br />
SELECT	table_name, column_name<br />
FROM	all_tab_columns<br />
--WHERE column_name LIKE '%%'<br />
--WHERE	table_name LIKE '%%'<br />
ORDER BY table_name, column_name<br />
</code></p>
<h2>Downloads</h2>
<p><a href="http://www.cogniza.com/blog/wp-content/Find_Tables_that_Contain_Column.10.rpt">Find Tables that Contain Column</a><br />
A Crystal Report that will search Oracle for columns that match a criteria.</p>
]]></content:encoded>
			<wfw:commentRss>http://cogniza.com/wordpress/2005/10/26/oracle-find-column-or-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

