 




<?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>IT Answers &#187; T-SQL 2008</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/tag/t-sql-2008/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2013 07:36:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Combining 2 queries in SQL 2008</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/combining-2-queries/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/combining-2-queries/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 15:34:54 +0000</pubDate>
		<dc:creator>DavidHa!!</dc:creator>
				<category><![CDATA[SQL 2008]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server administration]]></category>
		<category><![CDATA[SQL Server Query]]></category>
		<category><![CDATA[T-SQL 2008]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I am having a little trouble combining the following 2 queries into a single nested statement (if indeed it&#8217;s possible). Can anyone assist? Query 1: SELECT Eff_Date, CoNum, Brandname, COUNT(Brandname) AS CountOfBrandName FROM dbo.Products WHERE (Eff_Date BETWEEN &#8217;1/1/2010&#8242; AND &#8217;12/31/2010&#8242;) GROUP BY Eff_Date, CoNum, Brandname, DateApplied Query 2: SELECT Eff_Date, CoNum, SUM(CountOfBrandName) AS SUMofBrandNames FROM [...]]]></description>
				<content:encoded><![CDATA[<p>I am having a little trouble combining the following 2 queries into a single nested statement (if indeed it&#8217;s possible). Can anyone assist? <br/><br/> Query 1: <br/><br/> SELECT Eff_Date, CoNum, Brandname, COUNT(Brandname) AS CountOfBrandName FROM dbo.Products WHERE (Eff_Date BETWEEN &#8217;1/1/2010&#8242; AND &#8217;12/31/2010&#8242;) GROUP BY Eff_Date, CoNum, Brandname, DateApplied <br/><br/> Query 2: <br/><br/> SELECT Eff_Date, CoNum, SUM(CountOfBrandName) AS SUMofBrandNames FROM dbo.Query1 GROUP BY Eff_Date, CoNum ORDER BY Eff_Date <br/><br/> Can anyone assist in combining these 2 queries into a single nested statement? Can it be done without using a temp table?<br/><br/></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/combining-2-queries/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Objects  explorator FILTER  doesn&#8217;t work, SQL Server Management Studio de sql server 2008</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/objects-explorator-filter-doesnt-work-sql-server-management-studio-de-sql-server-2008/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/objects-explorator-filter-doesnt-work-sql-server-management-studio-de-sql-server-2008/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 09:20:30 +0000</pubDate>
		<dc:creator>Poussines</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Management Studio 2008]]></category>
		<category><![CDATA[T-SQL 2008]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Hello friends, On my PC (Windows Xp 2002 SP3) in SQL-Server management studio 2008, the object explorator filter doesn&#8217;t work. The funnel symbol is simply greyed. I can&#8217;t access to the box bialog filter parameters. Please, anybody has an idea ? Jean-Max PS : Microsoft SQL Server Management Studio version 10.0.2531.0]]></description>
				<content:encoded><![CDATA[<p>Hello friends, <br/><br/> On my PC (Windows Xp 2002 SP3) in SQL-Server management studio 2008, the object explorator filter doesn&#8217;t work. The funnel symbol is simply greyed. I can&#8217;t access to the box bialog filter parameters. Please, anybody has an idea ? <br/><br/> Jean-Max <br/><br/> PS : Microsoft SQL Server Management Studio version 10.0.2531.0<br/><br/></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/objects-explorator-filter-doesnt-work-sql-server-management-studio-de-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQL select loop list?</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/select-loop-list/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/select-loop-list/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 03:25:18 +0000</pubDate>
		<dc:creator>Vinical</dc:creator>
				<category><![CDATA[SELECT]]></category>
		<category><![CDATA[SQL 2008]]></category>
		<category><![CDATA[SQL Select]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[T-SQL 2008]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Say I want to derive the following: Select ID, F1 from table Union Select ID, F2 from table Union Select ID, F3 from table Union … etc until F10. Is there smart and easy way so that I can just provide a list: F1,F2,F3,…,F10 and somehow be able to have the select statement loop through [...]]]></description>
				<content:encoded><![CDATA[<p>Say I want to derive the following: Select ID, F1 from table Union Select ID, F2 from table Union Select ID, F3 from table Union … etc until F10. Is there smart and easy way so that I can just provide a list: F1,F2,F3,…,F10 and somehow be able to have the select statement loop through it? Also, in addition to 2 columns, ID and Fn, I would also like a third column in the result which states the field name F1, F2,…, F3. Thank you so much.</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/select-loop-list/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to automatically update Child Table with Insert Trigger and Table-UDF</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/how-to-automatically-update-child-table-with-insert-trigger-and-table-udf/</link>
		<comments>http://itknowledgeexchange.techtarget.com/itanswers/how-to-automatically-update-child-table-with-insert-trigger-and-table-udf/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 15:14:24 +0000</pubDate>
		<dc:creator>Ironryan77</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server triggers]]></category>
		<category><![CDATA[T-SQL 2008]]></category>
		<category><![CDATA[UDF]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I have SQL Server 2008 and Visual Studio 2008 and am trying to automatically insert new records into a child table based on new inserts into its parent table. I know that this should be simple: via an insert trigger. However, the complexity is that the new records into the child table need to be [...]]]></description>
				<content:encoded><![CDATA[<p>I have SQL Server 2008 and Visual Studio 2008 and am trying to automatically insert new records into a child table based on new inserts into its parent table.</p>
<p>I know that this should be simple: via an insert trigger.  However, the complexity is that the new records into the child table need to be a parsed version of one of the parent table&#8217;s fields.</p>
<p>To achieve this, I developed a table function which parses this one field in the parent table.<br />
Originally I had the Foreign Key defined below, but this wasn&#8217;t automatically inserting new records into my child table, so I commented it out.</p>
<p>I have tried writing both recursive and non-recursive insert triggers, but I have received errors on almost every attempt.  I was able to partly get non-recursive triggers to work&#8230;but without the parsing function.  I think the trick is that this is a table function.<br />
How should I design this?  Some of my pseudo code as follows:</p>
<p>CREATE TABLE ParentTable<br />
(<br />
ParentID INT IDENTITY(1,1) PRIMARY KEY NONCLUSTERED,<br />
strInput VARCHAR(8000) NULL<br />
)</p>
<p>CREATE TABLE ChildTable<br />
(<br />
ChildID INT IDENTITY(1,1) PRIMARY KEY NONCLUSTERED,<br />
ParentID INT,<br />
FullRow VARCHAR(8000)<br />
&#8211;I removed the following FK cause it wasn&#8217;t automatically inserting new records:<br />
&#8211;CONSTRAINT AddParentID FOREIGN KEY ParentID REFERENCES ParentTable(ParentID)<br />
)</p>
<p>Sample output of what I want is:<br />
ParentTable:<br />
ParentID	strInput<br />
1		&#8216;AAA|BB|CCCCCC|D|EE&#8217;<br />
2		&#8216;FFF|R|BC|D|EE&#8217;<br />
3		&#8216;GG|BB|CCHC|D|EE&#8217;</p>
<p>ChildTable:<br />
ChildID		ParentID	strInput<br />
1		1		&#8216;AAA&#8217;<br />
2		1		&#8216;BB&#8217;<br />
3		1		&#8216;CCCCCC&#8217;<br />
4		1		&#8216;D&#8217;<br />
5		1		&#8216;EE&#8217;<br />
6		2		&#8216;FFF&#8217;<br />
7		2		&#8216;R&#8217;<br />
8		2		&#8216;BC&#8217;<br />
9		2		&#8216;D&#8217;<br />
10		2		&#8216;EE&#8217;<br />
&#8230;</p>
<p>My table-function removes the &#8220;|&#8221; delimiter with strInput as its input.  How can I achieve the above results?</p>
<p>Thanks!</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/itanswers/how-to-automatically-update-child-table-with-insert-trigger-and-table-udf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/18 queries in 0.022 seconds using memcached
Object Caching 526/575 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-24 08:50:43 -->