﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Andy Warren / Article Discussions / Article Discussions by Author  / Partitioning - Part 3 / 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>Thu, 23 May 2013 06:31:24 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Partitioning - Part 3</title><link>http://www.sqlservercentral.com/Forums/Topic439857-29-1.aspx</link><description>Hi AndyThanks for this info and I can see how it works when running the queryselect * from dbo.Contact where lastname = 'green'However when trying the following, it reverts to looking at both underlying tables againDECLARE @lastname VARCHAR(10)SET @lastname = 'green'select * from dbo.Contact where lastname = @lastname Is there any way this can only look at the one table? Or would I have to write my stored procedures using dynamic sql to take advantage of this?</description><pubDate>Wed, 03 Dec 2008 05:45:33 GMT</pubDate><dc:creator>Richard Norris</dc:creator></item><item><title>RE: Partitioning - Part 3</title><link>http://www.sqlservercentral.com/Forums/Topic439857-29-1.aspx</link><description>Hello Tahir,two points:1. Use UNION ALL instead of UNION. Since you have distinct rows in both tables you don't need to remove duplicates.2. Cast or convert the date string to a smalldatetime:SELECT * FROM t12 WHERE dob&amp;gt;=CAST('20070101' AS smalldatetime)</description><pubDate>Mon, 28 Jan 2008 00:43:37 GMT</pubDate><dc:creator>Christian Buettner-167247</dc:creator></item><item><title>RE: Partitioning - Part 3</title><link>http://www.sqlservercentral.com/Forums/Topic439857-29-1.aspx</link><description>--Sql Server 2000create table t1 (sno int, dob smalldatetime,name char(10))create table t2 (sno int, dob smalldatetime,name char(10))insert into t1 select 1,'01-01-2006','a'insert into t1 select 2,'01-07-2006','b'insert into t2 select 3,'01-01-2007','c'insert into t2 select 4,'01-07-2007','d'create clustered index cdxt1 on t1(sno)create clustered index cdxt2 on t2(sno)create view T12 asselect * from dbo.t1unionselect * from dbo.t2select * from t12 where dob&amp;gt;='01-01-2007'--alter table t1 drop constraint ckt1--alter table t2 drop constraint ckt2alter table dbo.t1 with check add constraint CKt1 check ([dob] &amp;lt; '01-01-2007' )alter table dbo.t2 with check add constraint CKt2 check ([dob] &amp;gt;=  '01-01-2007' )Need help on how to create constraint on t1 and t2 for smalldatetime columns???as select * from t12 where dob&amp;gt;='01-01-2007'scanning both tables</description><pubDate>Sun, 27 Jan 2008 01:05:16 GMT</pubDate><dc:creator>Tahir-191992</dc:creator></item><item><title>RE: Partitioning - Part 3</title><link>http://www.sqlservercentral.com/Forums/Topic439857-29-1.aspx</link><description>One of the more advanced parts of SQL 2005 partitioning is switching partitions in/out. It's not hard to do, takes a minute to wrap your head around the idea. When it fits it's a very nice solution.</description><pubDate>Fri, 11 Jan 2008 09:12:51 GMT</pubDate><dc:creator>Andy Warren</dc:creator></item><item><title>RE: Partitioning - Part 3</title><link>http://www.sqlservercentral.com/Forums/Topic439857-29-1.aspx</link><description>Thanks for the article - I have been wanting to learn more about partitioning, and your explanations are so clear! In my case, I am dealing with a data warehouse and tables that have tens of millions of rows, updated daily of course. Is there a way to tweak your method so I don't have to recreate the partitioned tables daily?</description><pubDate>Fri, 11 Jan 2008 07:17:57 GMT</pubDate><dc:creator>ikf</dc:creator></item><item><title>RE: Partitioning - Part 3</title><link>http://www.sqlservercentral.com/Forums/Topic439857-29-1.aspx</link><description>Thanks for the feedback. There's definitely a ton of detail on partitioning that could be done, but I think it's one of those features that isn't that hard to learn if you need to, more important to know how it works in general so you can have the option to consider.</description><pubDate>Tue, 08 Jan 2008 05:43:37 GMT</pubDate><dc:creator>Andy Warren</dc:creator></item><item><title>RE: Partitioning - Part 3</title><link>http://www.sqlservercentral.com/Forums/Topic439857-29-1.aspx</link><description>Hi Andy!Thanks for this nice quickie! What I really like about this one is its simplicity and shortness. It doesn't always have to be the complete and in-depth analysis of a technology. The latter often scares people away because they think it is too complex and not worth investing all this time (definitively speaking about me here ;-). But getting results within a few moments removes this obstacle in my mind. Of course after the quick feedback I recommend every user to dive deeper into the details once the decision was made to utilize the specific technology.</description><pubDate>Tue, 08 Jan 2008 00:30:22 GMT</pubDate><dc:creator>Christian Buettner-167247</dc:creator></item><item><title>Partitioning - Part 3</title><link>http://www.sqlservercentral.com/Forums/Topic439857-29-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/articles/SQL+Server+2005/61676/"&gt;Partitioning - Part 3&lt;/A&gt;[/B]</description><pubDate>Mon, 07 Jan 2008 21:04:09 GMT</pubDate><dc:creator>Andy Warren</dc:creator></item></channel></rss>