<?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>Shawson&#039;s Code Blog &#187; SQL Server</title>
	<atom:link href="http://www.shawson.co.uk/codeblog/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shawson.co.uk/codeblog</link>
	<description>development notes for my failing memory</description>
	<lastBuildDate>Mon, 26 Jul 2010 19:08:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Example update with left outer join in SQL Server</title>
		<link>http://www.shawson.co.uk/codeblog/example-update-with-left-outer-join-in-sql-server/</link>
		<comments>http://www.shawson.co.uk/codeblog/example-update-with-left-outer-join-in-sql-server/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 14:42:18 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=608</guid>
		<description><![CDATA[I always seem to remember the access syntax for this rather than the sql server version&#8211;

update
    hachette_digitalideas_import
set
    harrietId = u.Id
from
    hachette_digitalideas_import h
    left outer join user_group u
        ON (h.email = u.email or h.[full name] = u.name) [...]


Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/sql-server-truncate-log/' rel='bookmark' title='Permanent Link: SQL Server truncate log'>SQL Server truncate log</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/cross-apply-in-sql/' rel='bookmark' title='Permanent Link: Cross Apply in SQL'>Cross Apply in SQL</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/whats-the-definitive-maximum-size-of-an-email-address/' rel='bookmark' title='Permanent Link: Whats the definitive maximum size of an email address?'>Whats the definitive maximum size of an email address?</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I always seem to remember the access syntax for this rather than the sql server version&#8211;</p>
<pre class="brush: sql">
update
    hachette_digitalideas_import
set
    harrietId = u.Id
from
    hachette_digitalideas_import h
    left outer join user_group u
        ON (h.email = u.email or h.[full name] = u.name) AND u.btype = &#039;u&#039;
</pre>
<p>As opposed to the following in access;</p>
<pre class="brush: sql">
update
    hachette_digitalideas_import
    left outer join user_group u
        ON (h.email = u.email or h.[full name] = u.name) AND u.btype = &#039;u&#039;
set
    harrietId = u.Id
</pre>


<p>Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/sql-server-truncate-log/' rel='bookmark' title='Permanent Link: SQL Server truncate log'>SQL Server truncate log</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/cross-apply-in-sql/' rel='bookmark' title='Permanent Link: Cross Apply in SQL'>Cross Apply in SQL</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/whats-the-definitive-maximum-size-of-an-email-address/' rel='bookmark' title='Permanent Link: Whats the definitive maximum size of an email address?'>Whats the definitive maximum size of an email address?</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.shawson.co.uk/codeblog/example-update-with-left-outer-join-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cross Apply in SQL</title>
		<link>http://www.shawson.co.uk/codeblog/cross-apply-in-sql/</link>
		<comments>http://www.shawson.co.uk/codeblog/cross-apply-in-sql/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 14:18:25 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=574</guid>
		<description><![CDATA[In Summary: I basically wanted to take the data in a table, then linked data from another table concatenated into a comma separated string, and attached as a varchar column on the end of the first table!
I have the mis-fortune of working on a terrible intranet system based on technology built by a company I [...]


Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/ssis-dts-packages-violating-referential-integrity/' rel='bookmark' title='Permanent Link: SSIS / DTS packages violating referential integrity'>SSIS / DTS packages violating referential integrity</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Permanent Link: Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/example-update-with-left-outer-join-in-sql-server/' rel='bookmark' title='Permanent Link: Example update with left outer join in SQL Server'>Example update with left outer join in SQL Server</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>In Summary: I basically wanted to take the data in a table, then linked data from another table concatenated into a comma separated string, and attached as a varchar column on the end of the first table!</p>
<p>I have the mis-fortune of working on a terrible intranet system based on technology built by a company I won&#8217;t actually name- so for the purpose of this post, lets say they are called Source.  It&#8217;s basically a big buggy CMS powered by some aging and creaky classic asp files and lashing of very frail javascript (this isn&#8217;t a legacy system- it was installed in the company around a year ago!).  It allows you to build forms and data grids, but is quite restrictive with how you attach these to the database- you cannot for example use a stored procedure as a data source- it has to be a table or a view.</p>
<p>We have an internal app to allow staff to order with a table structure like so;</p>
<p>OrderHeader -> OrderDetail -> Publisher -> Warehouse</p>
<p>On the order header view page we need to know which warehouses are involved, which means a query going right down the chain from product on the order line, to the publisher, down to which warehouse that publisher is based at- because we can only tie to a single table or view I had a problem unless i wanted loads of repeated rows- after some googling I found CROSS to be what I was after;</p>
<p><a href="http://databases.aspfaq.com/general/how-do-i-concatenate-strings-from-a-column-into-a-single-row.html">http://databases.aspfaq.com/general/how-do-i-concatenate-strings-from-a-column-into-a-single-row.html</a></p>
<p>Based on the above post I was able to build SQL like so;</p>
<pre class="brush: sql">

SELECT
	OrderHeader.id,
	OrderHeader.user_id,
	OrderHeader.OrderDate,
	Users.name,
	WareHouses = LEFT(o.list, LEN(o.list)-1)
FROM
	OrderHeader INNER JOIN
	User ON OrderHeader.UserId = User.UserId LEFT OUTER JOIN
CROSS APPLY
(
	SELECT distinct
		CONVERT(VARCHAR(50), WareHouse.Name) + &#039;,&#039; AS [text()]
	FROM
		WareHouse
		INNER JOIN Publishers ON WareHouse.id = Publishers.WarehouseId
		INNER JOIN OrderDetailLine ON Publishers.PublisherID = OrderDetailLine.PublisherID
	WHERE
		OrderDetailLine.OrderHeaderId = OrderHeader.OrderHeaderId
	ORDER BY
		CONVERT(VARCHAR(50), WareHouse.Name) + &#039;,&#039;
	FOR XML PATH(&#039;&#039;)
) o (list)
</pre>
<p>This bought me back each row, with a comma separated list of the warehouse names in the end column which i could then filter on!</p>


<p>Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/ssis-dts-packages-violating-referential-integrity/' rel='bookmark' title='Permanent Link: SSIS / DTS packages violating referential integrity'>SSIS / DTS packages violating referential integrity</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Permanent Link: Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/example-update-with-left-outer-join-in-sql-server/' rel='bookmark' title='Permanent Link: Example update with left outer join in SQL Server'>Example update with left outer join in SQL Server</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.shawson.co.uk/codeblog/cross-apply-in-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Full Text Reindex, scheduled job has no steps!</title>
		<link>http://www.shawson.co.uk/codeblog/full-text-reindex-scheduled-job-has-no-steps/</link>
		<comments>http://www.shawson.co.uk/codeblog/full-text-reindex-scheduled-job-has-no-steps/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 10:26:32 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[full text index]]></category>
		<category><![CDATA[scheduled maintenance]]></category>
		<category><![CDATA[sql server agent]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=446</guid>
		<description><![CDATA[We have a SQL Server 2005 box, on which we have a database which has a full text index.  The database gets a massive refresh of its data each night, meaning the full text index needs rebuilding.  I added a schedule to my full text index (Databases &#62; [DBName] &#62; Storage &#62; Full [...]


Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/how-to-run-sql-profiler-against-local-sql-express-instances/' rel='bookmark' title='Permanent Link: How to run SQL Profiler against local SQL Express instances'>How to run SQL Profiler against local SQL Express instances</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/sql-2000-font/' rel='bookmark' title='Permanent Link: SQL 2000 Font!'>SQL 2000 Font!</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/collation-issues-setting-up-aspnet-membership-tables/' rel='bookmark' title='Permanent Link: Collation issues setting up ASP.Net membership tables'>Collation issues setting up ASP.Net membership tables</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>We have a SQL Server 2005 box, on which we have a database which has a full text index.  The database gets a massive refresh of its data each night, meaning the full text index needs rebuilding.  I added a schedule to my full text index (Databases &gt; [DBName] &gt; Storage &gt; Full Text Catalogs &gt; Right click your index &#8211; click properties &gt; Population Schedule) and this created me a new job (SQL Server Agent &gt; Jobs) but when i opened it up and went to steps, nothing was there!  If i tried running the job it would fail because there are no steps!</p>
<p>I found this as a <a href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=257786&amp;wa=wsignin1.0#tabs">documented bug in the initial release candidate of sql 2005</a> (since fixed in the service packs) on the microsoft connect site, and added a workaround &#8211; basically just add your own job, using the following sql (<a href="http://msdn.microsoft.com/en-us/library/ms176095.aspx">which i found on msdn</a>) to rebuild your index;</p>
<pre class="brush: sql">
ALTER FULLTEXT CATALOG [catalogue_name] REBUILD;
</pre>
<p>Of course, this is only a workaround until we can get the latest service pack installed.</p>


<p>Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/how-to-run-sql-profiler-against-local-sql-express-instances/' rel='bookmark' title='Permanent Link: How to run SQL Profiler against local SQL Express instances'>How to run SQL Profiler against local SQL Express instances</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/sql-2000-font/' rel='bookmark' title='Permanent Link: SQL 2000 Font!'>SQL 2000 Font!</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/collation-issues-setting-up-aspnet-membership-tables/' rel='bookmark' title='Permanent Link: Collation issues setting up ASP.Net membership tables'>Collation issues setting up ASP.Net membership tables</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.shawson.co.uk/codeblog/full-text-reindex-scheduled-job-has-no-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to run SQL Profiler against local SQL Express instances</title>
		<link>http://www.shawson.co.uk/codeblog/how-to-run-sql-profiler-against-local-sql-express-instances/</link>
		<comments>http://www.shawson.co.uk/codeblog/how-to-run-sql-profiler-against-local-sql-express-instances/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 09:30:50 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[entity framework]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[sql profiler]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=421</guid>
		<description><![CDATA[I&#8217;m building a project using entity framework and wanted to ensure it wasn&#8217;t going mental and spamming the database with more queries than it should- this requires SQL Profiler, but i didn&#8217;t know how to connect it to my local instance of sql (I had just added an MDB file to the app&#8217;s app_data folder, [...]


Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Permanent Link: Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/full-text-reindex-scheduled-job-has-no-steps/' rel='bookmark' title='Permanent Link: Full Text Reindex, scheduled job has no steps!'>Full Text Reindex, scheduled job has no steps!</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/asp-net-membership-log-times-incorrect-in-the-database/' rel='bookmark' title='Permanent Link: ASP.net membership log times incorrect in the database'>ASP.net membership log times incorrect in the database</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m building a project using entity framework and wanted to ensure it wasn&#8217;t going mental and spamming the database with more queries than it should- this requires SQL Profiler, but i didn&#8217;t know how to connect it to my local instance of sql (I had just added an MDB file to the app&#8217;s app_data folder, so it was running via local sql express)</p>
<p>Turns out it&#8217;s easy- you just connect to .\SQLEXPRESS database and then execute this query against the master database;</p>
<pre class="brush: sql">
SELECT
owning_principal_name,
instance_pipe_name
FROM
sys.dm_os_child_instances
</pre>
<p>From the results you will be able fish out the &#8220;named pipe&#8221; that you can just put into the server name box when connecting with profiler.</p>
<div id="attachment_426" class="wp-caption alignnone" style="width: 310px"><img class="size-medium wp-image-426 " title="Sql Profiler connection dialogue" src="http://www.shawson.co.uk/codeblog/wp-content/uploads/2009/12/profiler-300x223.jpg" alt="Sql Profiler connection dialogue" width="300" height="223" /><p class="wp-caption-text">Sql Profiler connection dialogue</p></div>
<p>via <a href="http://bradwilson.typepad.com/blog/2008/12/profiling-sql-server-express-user-instances.html">Brad Wilson: Profiling SQL Server Express User Instances</a>.</p>


<p>Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Permanent Link: Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/full-text-reindex-scheduled-job-has-no-steps/' rel='bookmark' title='Permanent Link: Full Text Reindex, scheduled job has no steps!'>Full Text Reindex, scheduled job has no steps!</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/asp-net-membership-log-times-incorrect-in-the-database/' rel='bookmark' title='Permanent Link: ASP.net membership log times incorrect in the database'>ASP.net membership log times incorrect in the database</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.shawson.co.uk/codeblog/how-to-run-sql-profiler-against-local-sql-express-instances/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Whats the definitive maximum size of an email address?</title>
		<link>http://www.shawson.co.uk/codeblog/whats-the-definitive-maximum-size-of-an-email-address/</link>
		<comments>http://www.shawson.co.uk/codeblog/whats-the-definitive-maximum-size-of-an-email-address/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 09:41:12 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[E-Commerce]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[column length]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=402</guid>
		<description><![CDATA[I&#8217;ve written lots of app&#8217;s which store email addresses, and usually go for a nvarchar(100) to store them, but thought I would find out once and for all, what the actual maximum size was- just out of curiousity.
Having googled around, I came across a couple of lengthy posts on the matter (here and here), quoting [...]


Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/single-character-wildcards/' rel='bookmark' title='Permanent Link: Single Character Wildcards'>Single Character Wildcards</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/premailer-%e2%80%94-preflight-for-html-e-mail/' rel='bookmark' title='Permanent Link: Premailer — preflight for HTML e-mail'>Premailer — preflight for HTML e-mail</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Permanent Link: Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve written lots of app&#8217;s which store email addresses, and usually go for a nvarchar(100) to store them, but thought I would find out once and for all, what the actual maximum size was- just out of curiousity.</p>
<p>Having <a href="http://lmgtfy.com/?q=email+maximum+length" target="_blank">googled around</a>, I came across a couple of lengthy posts on the matter (<a href="http://www.eph.co.uk/resources/email-address-length-faq/" target="_blank">here </a>and <a href="http://stackoverflow.com/questions/386294/maximum-length-of-a-valid-email-id" target="_blank">here</a>), quoting figures from various standard (which seemed to point at 320 character), then corrections to those standards by members of ICANN based on the SMTP spec and so on and so forth&#8230;</p>
<p>After much trawling, it seems the official answer is : 254 characters (256 including the standard <> brackets around the address)</p>


<p>Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/single-character-wildcards/' rel='bookmark' title='Permanent Link: Single Character Wildcards'>Single Character Wildcards</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/premailer-%e2%80%94-preflight-for-html-e-mail/' rel='bookmark' title='Permanent Link: Premailer — preflight for HTML e-mail'>Premailer — preflight for HTML e-mail</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Permanent Link: Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.shawson.co.uk/codeblog/whats-the-definitive-maximum-size-of-an-email-address/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Conditional Order-By clause in SQL 2005</title>
		<link>http://www.shawson.co.uk/codeblog/conditional-order-by-clause-in-sql-2005/</link>
		<comments>http://www.shawson.co.uk/codeblog/conditional-order-by-clause-in-sql-2005/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 15:34:34 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=299</guid>
		<description><![CDATA[In SQL Server 2005 onwards you can have conditional Order By clauses in your stored proc&#8217;s- for example

SELECT EmployeeID, SalariedFlag
FROM HumanResources.Employee
ORDER BY CASE SalariedFlag WHEN 1 THEN EmployeeID END DESC
        ,CASE WHEN SalariedFlag = 0 THEN EmployeeID END;
GO

CASE (Transact-SQL).


Related posts:SQL 2000 Font!
Cross Apply in SQL
Full Text Reindex, scheduled [...]


Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/sql-2000-font/' rel='bookmark' title='Permanent Link: SQL 2000 Font!'>SQL 2000 Font!</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/cross-apply-in-sql/' rel='bookmark' title='Permanent Link: Cross Apply in SQL'>Cross Apply in SQL</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/full-text-reindex-scheduled-job-has-no-steps/' rel='bookmark' title='Permanent Link: Full Text Reindex, scheduled job has no steps!'>Full Text Reindex, scheduled job has no steps!</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>In SQL Server 2005 onwards you can have conditional Order By clauses in your stored proc&#8217;s- for example</p>
<pre class="brush: sql">
SELECT EmployeeID, SalariedFlag
FROM HumanResources.Employee
ORDER BY CASE SalariedFlag WHEN 1 THEN EmployeeID END DESC
        ,CASE WHEN SalariedFlag = 0 THEN EmployeeID END;
GO
</pre>
<p><a href="http://msdn.microsoft.com/en-us/library/ms181765.aspx">CASE (Transact-SQL)</a>.</p>


<p>Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/sql-2000-font/' rel='bookmark' title='Permanent Link: SQL 2000 Font!'>SQL 2000 Font!</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/cross-apply-in-sql/' rel='bookmark' title='Permanent Link: Cross Apply in SQL'>Cross Apply in SQL</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/full-text-reindex-scheduled-job-has-no-steps/' rel='bookmark' title='Permanent Link: Full Text Reindex, scheduled job has no steps!'>Full Text Reindex, scheduled job has no steps!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.shawson.co.uk/codeblog/conditional-order-by-clause-in-sql-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.Net Role &amp; Membership Providers (Under IIS7) &#8211; DOESN&#8217;T Work!</title>
		<link>http://www.shawson.co.uk/codeblog/aspnet-role-membership-providers-under-iis7-doesnt-work/</link>
		<comments>http://www.shawson.co.uk/codeblog/aspnet-role-membership-providers-under-iis7-doesnt-work/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 16:05:10 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=256</guid>
		<description><![CDATA[Ok well, it does, but I&#8217;ve had a very stressful afternoon at it&#8217;s merciless hands!  Just trying to get the ASP.Net roles &#38; membership working on asp.net 3.5, using IIS7.  I created the project and clicked &#8220;ASP.Net Confguration&#8221; from the project menu, but no working providers existed.
I defined some custom providers and nothing would get [...]


Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/how-to-run-sql-profiler-against-local-sql-express-instances/' rel='bookmark' title='Permanent Link: How to run SQL Profiler against local SQL Express instances'>How to run SQL Profiler against local SQL Express instances</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/collation-issues-setting-up-aspnet-membership-tables/' rel='bookmark' title='Permanent Link: Collation issues setting up ASP.Net membership tables'>Collation issues setting up ASP.Net membership tables</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/creating-a-re-usable-shopping-basket-with-generics-in-c-sharp/' rel='bookmark' title='Permanent Link: Creating a re-usable shopping basket with Generics in C#'>Creating a re-usable shopping basket with Generics in C#</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Ok well, it does, but I&#8217;ve had a very stressful afternoon at it&#8217;s merciless hands!  Just trying to get the ASP.Net roles &amp; membership working on asp.net 3.5, using IIS7.  I created the project and clicked &#8220;ASP.Net Confguration&#8221; from the project menu, but no working providers existed.</p>
<p>I defined some custom providers and nothing would get picked up.</p>
<p>It turns out, under IIS you need to define a connection string with a specific name to make this work&#8211;</p>
<pre class="brush: xml"> &lt;connectionStrings&gt;
    &lt;clear/&gt;
    &lt;add name=&quot;LocalSqlServer&quot; connectionString=&quot;your real connection string goes here!&quot; /&gt;
  &lt;/connectionStrings&gt;</pre>
<p>So we&#8217;re clearing out the default inherited connection strings then overriding the default LocalSqlServer connection to have the correct connection to our real database, as this appears to be the connection string it defaults to.</p>
<p>Save the web.config file, the fire up the &#8220;ASP.net configuration&#8221; site again and you should be away!</p>
<p>Thanks to <a href="http://www.flexicoder.com/" target="_blank">Mr Ledger</a> for channelling the awesome power of google through himself to yield that nugget of joy and relief!</p>


<p>Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/how-to-run-sql-profiler-against-local-sql-express-instances/' rel='bookmark' title='Permanent Link: How to run SQL Profiler against local SQL Express instances'>How to run SQL Profiler against local SQL Express instances</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/collation-issues-setting-up-aspnet-membership-tables/' rel='bookmark' title='Permanent Link: Collation issues setting up ASP.Net membership tables'>Collation issues setting up ASP.Net membership tables</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/creating-a-re-usable-shopping-basket-with-generics-in-c-sharp/' rel='bookmark' title='Permanent Link: Creating a re-usable shopping basket with Generics in C#'>Creating a re-usable shopping basket with Generics in C#</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.shawson.co.uk/codeblog/aspnet-role-membership-providers-under-iis7-doesnt-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collation issues setting up ASP.Net membership tables</title>
		<link>http://www.shawson.co.uk/codeblog/collation-issues-setting-up-aspnet-membership-tables/</link>
		<comments>http://www.shawson.co.uk/codeblog/collation-issues-setting-up-aspnet-membership-tables/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 14:07:54 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=251</guid>
		<description><![CDATA[Setup failed.
Exception:
An error occurred during the execution of the SQL file &#8216;InstallRoles.sql&#8217;. The SQL error number is 446 and the SqlException message is: Cannot resolve collation conflict for equal to operation.
Cannot resolve collation conflict for equal to operation.
I recently had this problem while trying to setup the roles &#38; memberships gubbins on a database using [...]


Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Permanent Link: Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/ssis-dts-packages-violating-referential-integrity/' rel='bookmark' title='Permanent Link: SSIS / DTS packages violating referential integrity'>SSIS / DTS packages violating referential integrity</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/scott-klueppels-blog-error-log-rss-feed/' rel='bookmark' title='Permanent Link: Scott Klueppel&#8217;s Blog &#8211; Error Log RSS Feed'>Scott Klueppel&#8217;s Blog &#8211; Error Log RSS Feed</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<blockquote><p>Setup failed.</p>
<p>Exception:<br />
An error occurred during the execution of the SQL file &#8216;InstallRoles.sql&#8217;. The SQL error number is 446 and the SqlException message is: Cannot resolve collation conflict for equal to operation.<br />
Cannot resolve collation conflict for equal to operation.</p></blockquote>
<p>I recently had this problem while trying to setup the roles &amp; memberships gubbins on a database using the aspnet_regsql tool on the v2 .net framework.</p>
<p>This turned out to be because this was a SQL 2005 database which we had imported from a third party, produced on SQL2005.  The SQL2005 database had a collaction of SQL_Latin1_General_CP1_CI_AS while our sql 2000 box&#8217;s default collection was Latin1_General_CI_AS.</p>
<p>The fix was simple; having backed up our database (!) simply run this command;</p>
<pre class="brush: sql">Alter Database testdatabase Collate Latin1_General_CI_AS</pre>
<p>This converted the database to the same Latin1_General_CI_AS collation as the server&#8217;s default, and allowed the aspnet_regsql to do it&#8217;s job unhindered!</p>
<p><strong><img class="alignright size-medium wp-image-254" title="remove_mode" src="http://www.shawson.co.uk/codeblog/wp-content/uploads/2009/07/remove_mode-300x230.jpg" alt="remove_mode" width="300" height="230" />NOTE: </strong>If you&#8217;ve ran aspnet_regsql once already before correcting your collation (which i would imagine you probably did!), make sure you run it again in remove mode before running a final time in install mode, as the first time it runs it will bomb out after creating some of the tables already leaving you with tables in your database still using the old collation!</p>


<p>Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Permanent Link: Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/ssis-dts-packages-violating-referential-integrity/' rel='bookmark' title='Permanent Link: SSIS / DTS packages violating referential integrity'>SSIS / DTS packages violating referential integrity</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/scott-klueppels-blog-error-log-rss-feed/' rel='bookmark' title='Permanent Link: Scott Klueppel&#8217;s Blog &#8211; Error Log RSS Feed'>Scott Klueppel&#8217;s Blog &#8211; Error Log RSS Feed</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.shawson.co.uk/codeblog/collation-issues-setting-up-aspnet-membership-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server truncate log</title>
		<link>http://www.shawson.co.uk/codeblog/sql-server-truncate-log/</link>
		<comments>http://www.shawson.co.uk/codeblog/sql-server-truncate-log/#comments</comments>
		<pubDate>Mon, 11 May 2009 08:07:25 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=167</guid>
		<description><![CDATA[The command line syntax for truncating the SQL log&#8217;s once they are full!

BACKUP &#60;db_name&#62; LOG  WITH TRUNCATE_ONLY



Related posts:Setting up session state database on sql server
Example update with left outer join in SQL Server
Assigning execute permissions to Stored procedure in bulk on sql server 2000



Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Permanent Link: Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/example-update-with-left-outer-join-in-sql-server/' rel='bookmark' title='Permanent Link: Example update with left outer join in SQL Server'>Example update with left outer join in SQL Server</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/assigning-execute-permissions-to-stored-procedure-in-bulk-on-sql-server-2000/' rel='bookmark' title='Permanent Link: Assigning execute permissions to Stored procedure in bulk on sql server 2000'>Assigning execute permissions to Stored procedure in bulk on sql server 2000</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>The command line syntax for truncating the SQL log&#8217;s once they are full!</p>
<pre class="brush: sql">
BACKUP &lt;db_name&gt; LOG  WITH TRUNCATE_ONLY
</pre>


<p>Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/setting-up-session-state-database-on-sql-server/' rel='bookmark' title='Permanent Link: Setting up session state database on sql server'>Setting up session state database on sql server</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/example-update-with-left-outer-join-in-sql-server/' rel='bookmark' title='Permanent Link: Example update with left outer join in SQL Server'>Example update with left outer join in SQL Server</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/assigning-execute-permissions-to-stored-procedure-in-bulk-on-sql-server-2000/' rel='bookmark' title='Permanent Link: Assigning execute permissions to Stored procedure in bulk on sql server 2000'>Assigning execute permissions to Stored procedure in bulk on sql server 2000</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.shawson.co.uk/codeblog/sql-server-truncate-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL 2000 Font!</title>
		<link>http://www.shawson.co.uk/codeblog/sql-2000-font/</link>
		<comments>http://www.shawson.co.uk/codeblog/sql-2000-font/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 10:39:00 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Accessibility]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/post.aspx?id=4e09481a-4e67-435f-8edd-ba1a1fedf705</guid>
		<description><![CDATA[Another simple one which i&#39;ve only just recently found out- changing the font in the stored procedure viewer under enterprise manager for sql 2000- when in the sql server window, right click and select font.&#160; Then update the &#34;Text&#34; property to the font of your choice and click OK.&#160; This make a permanent change to [...]


Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/assigning-execute-permissions-to-stored-procedure-in-bulk-on-sql-server-2000/' rel='bookmark' title='Permanent Link: Assigning execute permissions to Stored procedure in bulk on sql server 2000'>Assigning execute permissions to Stored procedure in bulk on sql server 2000</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/full-text-reindex-scheduled-job-has-no-steps/' rel='bookmark' title='Permanent Link: Full Text Reindex, scheduled job has no steps!'>Full Text Reindex, scheduled job has no steps!</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/ssis-dts-packages-violating-referential-integrity/' rel='bookmark' title='Permanent Link: SSIS / DTS packages violating referential integrity'>SSIS / DTS packages violating referential integrity</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Another simple one which i&#39;ve only just recently found out- changing the font in the stored procedure viewer under enterprise manager for sql 2000- when in the sql server window, right click and select font.&nbsp; Then update the &quot;Text&quot; property to the font of your choice and click OK.&nbsp; This make a permanent change to any future stored procedure windows.</p>


<p>Related posts:<ul><li><a href='http://www.shawson.co.uk/codeblog/assigning-execute-permissions-to-stored-procedure-in-bulk-on-sql-server-2000/' rel='bookmark' title='Permanent Link: Assigning execute permissions to Stored procedure in bulk on sql server 2000'>Assigning execute permissions to Stored procedure in bulk on sql server 2000</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/full-text-reindex-scheduled-job-has-no-steps/' rel='bookmark' title='Permanent Link: Full Text Reindex, scheduled job has no steps!'>Full Text Reindex, scheduled job has no steps!</a></li>
<li><a href='http://www.shawson.co.uk/codeblog/ssis-dts-packages-violating-referential-integrity/' rel='bookmark' title='Permanent Link: SSIS / DTS packages violating referential integrity'>SSIS / DTS packages violating referential integrity</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.shawson.co.uk/codeblog/sql-2000-font/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
