<?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>SQL Server | Woody Hayday | Blog</title>
	<atom:link href="https://blog.woodylabs.com/category/technology/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.woodylabs.com</link>
	<description>An exploration of life, technology and writing</description>
	<lastBuildDate>Tue, 13 Jan 2015 15:22:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://blog.woodylabs.com/wp-content/uploads/2015/01/cropped-woody-hayday-yosemite-glacier-point-32x32.jpg</url>
	<title>SQL Server | Woody Hayday | Blog</title>
	<link>https://blog.woodylabs.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>MySQL datetime examples &#8211; first/last day of the year &#8211; dates and unix-times</title>
		<link>https://blog.woodylabs.com/2011/11/mysql-datetime-examples-firstlast-day-of-the-year-dates-and-unix-times/</link>
					<comments>https://blog.woodylabs.com/2011/11/mysql-datetime-examples-firstlast-day-of-the-year-dates-and-unix-times/#comments</comments>
		
		<dc:creator><![CDATA[Woody]]></dc:creator>
		<pubDate>Thu, 10 Nov 2011 09:09:22 +0000</pubDate>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Transactional SQL]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Technology]]></category>
		<category><![CDATA[data schemas]]></category>
		<category><![CDATA[facebook data acquisition]]></category>
		<category><![CDATA[facebook graph api]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySQL Workbench]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[Timestamps]]></category>
		<category><![CDATA[UNIX]]></category>
		<guid isPermaLink="false">http://blog.woodylabs.com/?p=797</guid>

					<description><![CDATA[<p>For some reason I had an abstract memory of SQL SERVER 2000, timestamps and pain. Who knows why. Perhaps its a faulty memory. lol. Anyhow working with timestamps in MySQL/MSSQL these days is nothing short of simple. With MySQL Workbench free its ridiculous how far the barrier of entry for database design has come, its [&#8230;]</p>
<p>The post <a href="https://blog.woodylabs.com/2011/11/mysql-datetime-examples-firstlast-day-of-the-year-dates-and-unix-times/">MySQL datetime examples – first/last day of the year – dates and unix-times</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p><hr /><a href="https://blog.woodylabs.com">Visit Woody Haydays Blog</a><hr />]]></description>
										<content:encoded><![CDATA[<p>For some reason I had an abstract memory of SQL SERVER 2000, timestamps and pain. Who knows why. Perhaps its a faulty memory. lol. Anyhow working with timestamps in MySQL/MSSQL these days is nothing short of simple. With MySQL Workbench free its ridiculous how far the barrier of entry for database design has come, its now all pleasant schema&#8217;s and error messages that make sense, gone are the days of spending half the time fixing/navigating the database system, they just work now (99% of the time) what a lucky generation of programmers! Anyhow here&#8217;s some datetime examples that you might find useful:</p>
<p>Get last day of last year &#8211; obvious, but still (+1 this for first day):</p>
<pre class="brush: sql; title: ; notranslate">SELECT DATE(CURDATE()- INTERVAL DAYOFYEAR(CURDATE()) DAY);</pre>
<p>And how useful&#8230; FROM_UNIXTIME takes a unix timestamp and makes it a friendly datetime, its like they KNOW I am coding for facebook data acquisition&#8230;Anyhow&#8230;</p>
<p>To make a GMT UNIX time-stamp for the first day of this month:</p>
<pre class="brush: sql; title: ; notranslate">SELECT UNIX_TIMESTAMP(CONVERT_TZ(DATE(CURDATE()- INTERVAL DAYOFMONTH(CURDATE()) DAY), '+0:00', 'SYSTEM'));</pre>
<p>You can switch out the dates obviously, and there are probably other ways, still, mostly pain free.  </p><p>The post <a href="https://blog.woodylabs.com/2011/11/mysql-datetime-examples-firstlast-day-of-the-year-dates-and-unix-times/">MySQL datetime examples – first/last day of the year – dates and unix-times</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://blog.woodylabs.com/2011/11/mysql-datetime-examples-firstlast-day-of-the-year-dates-and-unix-times/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>From SQL Server 2008 r2 to SQL Compact Edition. Doing things the wrong way.</title>
		<link>https://blog.woodylabs.com/2010/12/from-sql-server-2008-r2-to-sql-compact-edition-doing-things-the-wrong-way/</link>
		
		<dc:creator><![CDATA[Woody]]></dc:creator>
		<pubDate>Tue, 21 Dec 2010 11:56:59 +0000</pubDate>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Transactional SQL]]></category>
		<guid isPermaLink="false">http://blog.woodylabs.com/?p=451</guid>

					<description><![CDATA[<p>Program written using csharp and SQL Server 2008 r2? Great eh? &#8230; What about your users? &#8230;Doh. Anyway its good to re look at your data layer, so if this crops up and you need to switch to a more portable solution (Compact edition means anyone can use it on windows) then put in the [&#8230;]</p>
<p>The post <a href="https://blog.woodylabs.com/2010/12/from-sql-server-2008-r2-to-sql-compact-edition-doing-things-the-wrong-way/">From SQL Server 2008 r2 to SQL Compact Edition. Doing things the wrong way.</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p><hr /><a href="https://blog.woodylabs.com">Visit Woody Haydays Blog</a><hr />]]></description>
										<content:encoded><![CDATA[<p>Program written using csharp and SQL Server 2008 r2? Great eh? &#8230; What about your users? &#8230;Doh. Anyway its good to re look at your data layer, so if this crops up and you need to switch to a more portable solution (Compact edition means anyone can use it on windows) then put in the time. Heres a few snippets of SQL changes that you will need to deal with in recreating your tables in SQL Compact Edition (moving from full blown SQL server auto scripting)</p>
<ul>
<li>Dont try to SET anything, skip them. ANSI_NULLs, ANSI_PADDING</li>
<li>Replace CURRENT_TIMESTAMP with (getdate()) &#8211; easy to forget this but I always seem to use it as a default.</li>
<li>Keep constraints on line</li>
</ul>
<div align="center"><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-452" title="sql-full-to-sql-compact" src="https://blog.woodylabs.com/wp-content/uploads/2010/12/sql-full-to-sql-compact.png" alt="" width="256" height="256" srcset="https://blog.woodylabs.com/wp-content/uploads/2010/12/sql-full-to-sql-compact.png 256w, https://blog.woodylabs.com/wp-content/uploads/2010/12/sql-full-to-sql-compact-250x250.png 250w" sizes="(max-width: 256px) 100vw, 256px" /><br />
Of course if you wrote your tables from scratch in T-SQL it probably wont be a problem.</div><p>The post <a href="https://blog.woodylabs.com/2010/12/from-sql-server-2008-r2-to-sql-compact-edition-doing-things-the-wrong-way/">From SQL Server 2008 r2 to SQL Compact Edition. Doing things the wrong way.</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Forget Inertia &#8211; A new era.</title>
		<link>https://blog.woodylabs.com/2010/12/forget-inertia-a-new-era/</link>
		
		<dc:creator><![CDATA[Woody]]></dc:creator>
		<pubDate>Thu, 02 Dec 2010 14:02:40 +0000</pubDate>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Looking Back]]></category>
		<category><![CDATA[Looking Forward]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Technology]]></category>
		<category><![CDATA[WoodyLabs]]></category>
		<category><![CDATA[Emancipator]]></category>
		<category><![CDATA[Evernote]]></category>
		<category><![CDATA[Harpers Magazine]]></category>
		<category><![CDATA[M. Scott Peck]]></category>
		<category><![CDATA[Nepal]]></category>
		<category><![CDATA[reddit]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[Thailand]]></category>
		<category><![CDATA[Travelling]]></category>
		<guid isPermaLink="false">http://blog.woodylabs.com/?p=420</guid>

					<description><![CDATA[<p>There is by far enough written words about the freedom and positives of leaving ones established job, for better or for worse I think it is the right way forward for me, now. I have had a long list of things to post about, technology thoughts and projects completed; now thankfully I have the control [&#8230;]</p>
<p>The post <a href="https://blog.woodylabs.com/2010/12/forget-inertia-a-new-era/">Forget Inertia – A new era.</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p><hr /><a href="https://blog.woodylabs.com">Visit Woody Haydays Blog</a><hr />]]></description>
										<content:encoded><![CDATA[<p>There is by far enough written words about the freedom and positives of leaving ones established job, for better or for worse I think it is the right way forward for me, now. I have had a long list of things to post about, technology thoughts and projects completed; now thankfully I have the control of my time enough that I can post about them.</p>
<div align="center"><img decoding="async" class="aligncenter" title="Thailand Phi Phi - Buckets with good friends" src="https://blog.woodylabs.com/wp-content/uploads/2010/04/pp-buckets.jpg" alt="" /><img decoding="async" class="aligncenter size-full wp-image-422" title="bandipur-nepal-office-in-the-clouds" src="https://blog.woodylabs.com/wp-content/uploads/2010/12/bandipur-nepal-office-in-the-clouds.jpg" alt="" width="360" height="270" /></div>
<p>2010 Has been a good year for travel, from the sandy cocktail beach&#8217;s and fast paced mountain biking through lychee groves of Thailand across to the lake of Pokhara and the remote Bandipur in Nepal; sidestepping riots in both countries and a ridiculous ash cloud, through grace or luck. From central park and the Guggenheim to the Robert Moses beach and Long Island, New York was epic; and now in 48 hours or so on to Agadir, Marakesh, Casablanca and Fez, Morocco, its been a good year for travel.</p>
<div align="center"><img decoding="async" class="aligncenter size-full wp-image-421" title="bandipur-nepal" src="https://blog.woodylabs.com/wp-content/uploads/2010/12/bandipur-nepal.jpg" alt="" width="360" height="270" /><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-423" title="yankee-stadium-ny-yankees" src="https://blog.woodylabs.com/wp-content/uploads/2010/12/yankee-stadium-ny-yankees.jpg" alt="" width="360" height="270" /></div>
<p><span id="more-420"></span></p>
<p>While at home I have also picked up climbing, something I wish I had done more of while in Thailand. The Castle near Finsbury park is a fantastic location, especially when visited with a few good friends. I need to do more of that. I also look forward to a time when I have a piano in a house of mine so I can truely take that forward and carry on learning <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<div align="center"><img decoding="async" title="reddit wallpaper downloader" src="https://blog.woodylabs.com/wp-content/uploads/2011/07/previewWallpapersAndSelect.jpg" alt="" /></div>
<p>Through work and exploration this year I have absorbed C#, something I am quite happy with as it bridges the gap in my skillset between open-source and MSFT, between web programming and local app development. In my opinion it is also a good year for Microsoft, despite their mediocre year on NASDAQ; they are releasing much more rounded products and seem to be beginning to see the benefits of what I see as a change in strategy. Either way C# has lead me to refine my rapid application development and brought the brute modern processing power directly into use, I would thoroughly suggest it to supplement your language base if you are leant heavily towards php/LAMP (while I would only use it over php for few of my future web projects.) RAD in C# let me experiment with an <a href="https://blog.woodylabs.com/2010/08/arbitrage-betting-programmatically-finding-arbitrage-bets/" target="_blank">arbitrage betting program</a> and write a quick <a href="https://blog.woodylabs.com/reddit-wallpaper-grabber/" target="_blank">Reddit wallpaper grabber</a> (yes I know it needs fixing); as well as a bunch of other stuff like a Filezilla bulk user import, an SQL-&gt;php hardcoded rewrite of a huge site that meant 300% quicker loads, a remote image processing app, tons of little <a href="http://www.sharepointcode.co.uk" target="_blank">sharepoint integration</a> bits, a full sharepoint 2010 site migration routine and also a true 3rd gen website asset management tool, which I will perhaps post more about.</p>
<p>Near U has had a fairly good year and I have added a few more sites to the portfolio (I still need to diversify though) &#8211; mostly bolstering and fulfilling old ideas for domains that have been stagnating, I hope to shift this up a gear to bring it all back into line now I have the freedom to do so; the cold financial climate does seem to have slowed people buying cars, specifically though on-line auctions this past quarter but I have high hopes for the new year. Part of managing this portfolio of now more than 200 sites has been writing up a proper asset management tool geared towards websites (mostly affiliate) as assets of value, csharp has allowed me to write this multi threaded, flexible, detail rich program in a ridiculous short stint of evening programming, perhaps it may even make its way as a sell-able tool, this however is to be seen.</p>
<p>In the last few months I have also been running with Sharepoint 2010 (another example of microsoft getting themselves together) &#8211; which although on its preface is limited or &#8220;nothing new&#8221; in fact has quite sufficient enough depth to hold weight as an intranet solution. I doubt you will find better workflow, versioning, integration and scope in a web-based solution (even if it is £120k for enterprise for 1000+ users) &#8211; developers should not be scared of it. To supplement a sharepoint installation I would also advise the familiarisation of developers with WCF, microsofts best answer to web services moving forward.</p>
<div align="center"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-425" title="harpers-mag" src="https://blog.woodylabs.com/wp-content/uploads/2010/12/harpers-mag.png" alt="" width="305" height="100" /></div>
<p>There has been a few good books recently which have also left a resounding impression, <a title="The road less travelled is epic" href="http://www.amazon.co.uk/gp/product/0099727404?ie=UTF8&amp;tag=woodylabs-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=0099727404" rel="nofollow" target="_blank">The Road Less Travelled</a><img loading="lazy" decoding="async" style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.co.uk/e/ir?t=woodylabs-21&amp;l=as2&amp;o=2&amp;a=0099727404" alt="" width="1" height="1" border="0" /> (by M. Scott Peck) left me thinking more about the sub concious and revealed new angles on understanding people will that I will forever remember. In Nepal I left my copy of <a title="Its important to be happy" href="http://www.amazon.co.uk/gp/product/0340750154?ie=UTF8&amp;tag=woodylabs-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=0340750154" rel="nofollow" target="_blank">The Art of Happiness</a><img loading="lazy" decoding="async" style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.co.uk/e/ir?t=woodylabs-21&amp;l=as2&amp;o=2&amp;a=0340750154" alt="" width="1" height="1" border="0" /> on a bus, but luckily found another copy in a bookshop in Pokhara; it is a fantastic book that taught me more than anything to see things more clearly and seek contentment truthfully. <a title="The richest man in babylon" href="http://www.amazon.co.uk/gp/product/0451205367?ie=UTF8&amp;tag=woodylabs-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=0451205367" rel="nofollow" target="_blank">The Richest Man in Babylon</a><img loading="lazy" decoding="async" style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.co.uk/e/ir?t=woodylabs-21&amp;l=as2&amp;o=2&amp;a=0451205367" alt="" width="1" height="1" border="0" /> was suggested to me by a friend who is investing in silver, which <a href="http://www.ebullionguide.com/price-chart-silver-last-10-years.aspx" rel="nofollow" target="_blank">seems sensible</a> &#8211; what a fantastic little book! some basic rules on managing money are told through a Babylonian narrative which is fun and quick to read. If reading like this was more present in our schools we would all be wealthier, at least everyone except producers of instant gratification goods. I also subscribed to <a href="http://www.harpers.org" target="_blank">Harpers</a> this year, after finding it in Bangkok airport with hours to kill. It has significantly inspired me to proceed with writing my novel, it is always a great read and the harpers index is good:</p>
<blockquote><p>Percentage of U.S. car owners who keep maps in their glove compartments: 50, Sunglasses: 23, Gloves: 0</p>
<p>Estimated value of Chinese household income that goes unreported: $1,400,000,000,000; Portion of China&#8217;s GDP this represents: 1/3</p>
<p>Number of poisonous dead mice the USDA airdropped into Guam this year to eradicate an invasive snake species: 316</p>
<p>Number of times between January and June that google turned over user information to government investigators: 4,287</p></blockquote>
<p>Might have already posted about this before but <a href="http://www.evernote.com" rel="nofollow" target="_blank">Evernote</a> has served me well all year, allowing me to dump my ideas, wacky thoughts or notes into a single searchable repository, wherever I am. I also started backing up to the cloud (cant wait to write new software that takes advantage of the amazon storage cloud) via JungleDisk, which seems to be pretty spot on for me, and backing up iphone contacts to Google contacts was also a helpful find. If you guys are not yet using Chromium (NOT Chrome), that&#8217;s another no-brainer. <a href="http://build.chromium.org/f/chromium/snapshots/chromium-rel-xp/" rel="nofollow" target="_blank">Install it</a>, you&#8217;ll see what I mean (sorry Mozilla, you were trumped on speed.) Spotify has continued to be epic, even if the lack of nichey remix&#8217;s and the removal of some epic songs is irritating. Finally I have to say that Microsoft dropping their Express versions of visual studio 2010 and SQL Server is both useful, and strategically a good idea. Their IDE is pretty ridiculously good, and providing free (although slightly limited &#8211; SQL max db of 5gb for example) versions will bring in the hordes, and if they develop anything decent, chances are they will shell out for licences legitimately.</p>
<div align="center"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-424" title="emancipator-goodmusic" src="https://blog.woodylabs.com/wp-content/uploads/2010/12/emancipator-goodmusic.jpg" alt="" width="360" height="245" /><br />
Best music find of recent months: <a href="http://open.spotify.com/album/1KHKPYKo4h8btHa8u3wjEB" target="_blank">Emancipator</a></div>
<p>Looking forwards I now cant wait to finish my novel, write a bunch of new useful softwares and in 2011 start another business, perhaps a software house selling software as a service? I have a pretty devilishly good idea that will leverage the amazon clouds scalability. Perhaps. Either way I fly to Morocco in 48 hours and I haven&#8217;t even thought about it yet. Better go.</p>
<div align="center"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-426" title="eh-novel" src="https://blog.woodylabs.com/wp-content/uploads/2010/12/eh-novel.png" alt="" width="341" height="176" /><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-427" title="eh-bt" src="https://blog.woodylabs.com/wp-content/uploads/2010/12/eh-bt.png" alt="" width="297" height="382" /></div><p>The post <a href="https://blog.woodylabs.com/2010/12/forget-inertia-a-new-era/">Forget Inertia – A new era.</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>ReSeed Identity column &#8211; TSQL</title>
		<link>https://blog.woodylabs.com/2009/11/reseed-identity-column-tsql/</link>
		
		<dc:creator><![CDATA[Woody]]></dc:creator>
		<pubDate>Mon, 09 Nov 2009 18:08:24 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Transactional SQL]]></category>
		<guid isPermaLink="false">http://blog.woodylabs.com/?p=113</guid>

					<description><![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) TSQL</p>
<p>The post <a href="https://blog.woodylabs.com/2009/11/reseed-identity-column-tsql/">ReSeed Identity column – TSQL</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p><hr /><a href="https://blog.woodylabs.com">Visit Woody Haydays Blog</a><hr />]]></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><p>The post <a href="https://blog.woodylabs.com/2009/11/reseed-identity-column-tsql/">ReSeed Identity column – TSQL</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>xp_fileexist Network Drive &#8211; T SQL Based File checking</title>
		<link>https://blog.woodylabs.com/2009/05/xp_fileexist-network-drive-t-sql-based-file-checking/</link>
		
		<dc:creator><![CDATA[Woody]]></dc:creator>
		<pubDate>Thu, 07 May 2009 16:17:31 +0000</pubDate>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Transactional SQL]]></category>
		<guid isPermaLink="false">http://blog.woodylabs.com/?p=63</guid>

					<description><![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 [&#8230;]</p>
<p>The post <a href="https://blog.woodylabs.com/2009/05/xp_fileexist-network-drive-t-sql-based-file-checking/">xp_fileexist Network Drive – T SQL Based File checking</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p><hr /><a href="https://blog.woodylabs.com">Visit Woody Haydays Blog</a><hr />]]></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>
<blockquote>
<p>&#8211;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 />
&#8211;select top 10 FileDirectory + FileName from files &#8211; 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 = &#8216;\\192.168.1.8\f$\Files\&#8217; + @fileAt<br />
&#8211;this will depend on your network address</p>
<p>print &#8216;Searching for &#8216;+@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)<br />
&#8211;doesnt check for already existing, archives by date though<br />
print &#8216;&#8230;NOT FOUND &#8211; Recorded to DB&#8217;<br />
end<br />
if @fileEx = 1<br />
begin<br />
print &#8216;&#8230;OK&#8217;<br />
end</p>
<p>set @fileEx = 0<br />
set @fileAt = &#8221;<br />
FETCH NEXT FROM checkCursor<br />
INTO @fileAt<br />
END</p>
<p>CLOSE checkCursor<br />
DEALLOCATE checkCursor</p>
</blockquote>
<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>
<blockquote>
<p>exec sp_configure &#8216;show advanced options&#8217;, 1</p>
<p>go</p>
<p>reconfigure</p>
<p>go</p>
<p>exec sp_configure &#8216;xp_cmdshell&#8217;, 1</p>
<p>go</p>
<p>reconfigure</p>
<p>go</p>
</blockquote>
<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><p>The post <a href="https://blog.woodylabs.com/2009/05/xp_fileexist-network-drive-t-sql-based-file-checking/">xp_fileexist Network Drive – T SQL Based File checking</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server Reporting Services</title>
		<link>https://blog.woodylabs.com/2009/04/sql-server-reporting-services/</link>
		
		<dc:creator><![CDATA[Woody]]></dc:creator>
		<pubDate>Thu, 09 Apr 2009 17:38:38 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSRS]]></category>
		<guid isPermaLink="false">http://blog.woodylabs.com/?p=44</guid>

					<description><![CDATA[<p>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 [&#8230;]</p>
<p>The post <a href="https://blog.woodylabs.com/2009/04/sql-server-reporting-services/">SQL Server Reporting Services</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p><hr /><a href="https://blog.woodylabs.com">Visit Woody Haydays Blog</a><hr />]]></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 loading="lazy" decoding="async" 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 loading="lazy" decoding="async" 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><p>The post <a href="https://blog.woodylabs.com/2009/04/sql-server-reporting-services/">SQL Server Reporting Services</a> first appeared on <a href="https://blog.woodylabs.com">Woody Hayday | Blog</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
