<?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>Woody Hayday &#124; Blog &#187; SQL Server</title>
	<atom:link href="http://blog.woodylabs.com/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.woodylabs.com</link>
	<description>Hertfordshire .NET / SQL / PHP / Web Marketing and Business Developer and Consultant</description>
	<lastBuildDate>Wed, 07 Jul 2010 13:23:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>ReSeed Identity column &#8211; TSQL</title>
		<link>http://blog.woodylabs.com/2009/11/reseed-identity-column-tsql/</link>
		<comments>http://blog.woodylabs.com/2009/11/reseed-identity-column-tsql/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 18:08:24 +0000</pubDate>
		<dc:creator>Woody</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Transactional SQL]]></category>

		<guid isPermaLink="false">http://blog.woodylabs.com/?p=113</guid>
		<description><![CDATA[Randomly I didn&#8217;t remember the code to reseed the identity column in tsql, this works though on ms sql 2008 &#8211; DBCC CHECKIDENT (tbl_crazyTableName, RESEED, 20000) TSQL]]></description>
			<content:encoded><![CDATA[<p>Randomly I didn&#8217;t remember the code to reseed the identity column in tsql, this works though on ms sql 2008 &#8211; DBCC CHECKIDENT (tbl_crazyTableName, RESEED, 20000)</p>
<div align="center" style="font-size:50px;height:60px;"><span style="color:#ccc">T</span>SQL</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.woodylabs.com/2009/11/reseed-identity-column-tsql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xp_fileexist Network Drive &#8211; T SQL Based File checking</title>
		<link>http://blog.woodylabs.com/2009/05/xp_fileexist-network-drive-t-sql-based-file-checking/</link>
		<comments>http://blog.woodylabs.com/2009/05/xp_fileexist-network-drive-t-sql-based-file-checking/#comments</comments>
		<pubDate>Thu, 07 May 2009 16:17:31 +0000</pubDate>
		<dc:creator>Woody</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Transactional SQL]]></category>

		<guid isPermaLink="false">http://blog.woodylabs.com/?p=63</guid>
		<description><![CDATA[If you didn&#8217;t already know you can check whether files exist, find file sizes and all sorts of other useful things directly from within Transactional SQL Query. In this example I had a table containing a few columns that gave me the network drive location and filename of a few thousand files and I wanted [...]]]></description>
			<content:encoded><![CDATA[<p>If you didn&#8217;t already know you can check whether files exist, find file sizes and all sorts of other useful things directly from within Transactional SQL Query. In this example I had a table containing a few columns that gave me the network drive location and filename of a few thousand files and I wanted to verify that every file at this address existed in reality.</p>
<p>Here is how I managed it:</p>
<p><code lang="sql"></p>
<p>--make procedure to cycle trhough entrants and assign them to a room<br />
create procedure [dbo].[files_2_check] as<br />
DECLARE @fileAt varchar(2000)<br />
DECLARE @fileEx int</p>
<p>DECLARE checkCursor CURSOR FOR<br />
--select top 10 FileDirectory + FileName from files - USE to test it first<br />
select FileDirectory + FileName fromfiles</p>
<p>OPEN checkCursor</p>
<p>FETCH NEXT FROM checkCursor<br />
INTO @fileAt</p>
<p>WHILE @@FETCH_STATUS = 0<br />
BEGIN</p>
<p>set @fileAt = '\\192.168.1.8\f$\Files\' + @fileAt --this will depend on your network address</p>
<p>print 'Searching for '+@fileAt<br />
EXEC master..xp_fileexist @fileAt, @fileEx OUTPUT;</p>
<p>if @fileEx = 0<br />
begin<br />
insert into dbo.tbl_fileCheck (fileLoc) Values (@fileAt) --doesnt check for already existing, archives by date though<br />
print '...NOT FOUND - Recorded to DB'<br />
end<br />
if @fileEx = 1<br />
begin<br />
print '...OK'<br />
end</p>
<p>set @fileEx = 0<br />
set @fileAt = ''<br />
FETCH NEXT FROM checkCursor<br />
INTO @fileAt<br />
END</p>
<p>CLOSE checkCursor<br />
DEALLOCATE checkCursor</p>
<p></code></p>
<p>Which basically grabs the rows containing the file directory/filename and uses a cursor to cycle through each one checking them using the xp_fileexist command. There were a number of ways available to do the actual file exist checking but this one suited best, This solution definately works on SQL2005 and forwards, although did need a few additionals:</p>
<p>Turn on the setting (potential security issues if this is on 24/7, but you could run it on a vanila ms sql db server elsewhere) &#8211; Worth turning off afterwards.</p>
<p><code lang="sql"></p>
<p>exec sp_configure 'show advanced options', 1</p>
<p>go</p>
<p>reconfigure</p>
<p>go</p>
<p>exec sp_configure 'xp_cmdshell', 1</p>
<p>go</p>
<p>reconfigure</p>
<p>go</p>
<p></code></p>
<p>Apply admin rights to the MS SQL Windows service &#8211; by default this will only have local scope, it needs you to go to the services properties, then logon tab and assign it a user which has scope to view the files its checking exist over the network.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.woodylabs.com/2009/05/xp_fileexist-network-drive-t-sql-based-file-checking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server Reporting Services</title>
		<link>http://blog.woodylabs.com/2009/04/sql-server-reporting-services/</link>
		<comments>http://blog.woodylabs.com/2009/04/sql-server-reporting-services/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 17:38:38 +0000</pubDate>
		<dc:creator>Woody</dc:creator>
				<category><![CDATA[Report Writing]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://blog.woodylabs.com/?p=44</guid>
		<description><![CDATA[SQL Server Reporting Services – Microsoft Reporting Services – Microsoft Visual Basic Reports – Microsoft Visual Studio Reports Whatever name you want to give them there is a great capacity in cutting edge Microsoft developer’s tools. You have to give it to them; they do continue to roll out tool after tool aimed solely at [...]]]></description>
			<content:encoded><![CDATA[<p>SQL Server Reporting Services – Microsoft Reporting Services – Microsoft Visual Basic Reports – Microsoft Visual Studio Reports</p>
<p>Whatever name you want to give them there is a great capacity in cutting edge Microsoft developer’s tools. You have to give it to them; they do continue to roll out tool after tool aimed solely at developers. Being a diehard fan of crystal reports and having written a fair few Visual Basic reports in Microsoft access back in school I wasn’t expecting to be that happy changing again, adapting to a new set of tools. SSRS though is actually quite good. A little learning about the structure of VS08 report writing/deploying and I was there.</p>
<p>I think there is still the need to bridge the gap for Microsoft, from SQL Management Studio (which by the way just gets better with age) to its reporting arm. Writing a query in SQL Management Studio and copying it is all well and good, but essentially it requires training a user up, giving rights and permissions to a user in two different contexts (that of the report deploying and writing environment and also SQL MGR Studio.) For the apt this is quickly picked up but when training the less capable there seems almost a gap between the two products. While we can all endeavour to employ only the talented, it would be the icing on the cake if a more simplistic solution was available.</p>
<p>Once over the initial hurdles of SSRS it soon steps up to crystal reports and certainly is capable of completing on 95% of the reports I have ever written. Crystal Reports does still have a minute edge in my mind but the learning curve to use Visual Studio to write reports was tiny, excellent for management reporting.</p>
<p>If you are using or have used crystal reports, I would suggest recreating a few reports in Sql server reporting services from scratch, maybe getting a book (SSRS <a href="http://www.amazon.co.uk/gp/product/0735622507?ie=UTF8&#038;tag=microprojectors-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0735622507" rel="nofollow">2005</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=microprojectors-21&#038;l=as2&#038;o=2&#038;a=0735622507" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
 or <a href="http://www.amazon.co.uk/gp/product/0071548084?ie=UTF8&#038;tag=microprojectors-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0071548084" rel="nofollow">2008</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=microprojectors-21&#038;l=as2&#038;o=2&#038;a=0071548084" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />) on it if you don&#8217;t feel confident enough to wing it. You should find it easy to pick up and it&#8217;s an invaluable tool for management and integration into any web application.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.woodylabs.com/2009/04/sql-server-reporting-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
