<?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>FlexiCoder Blog &#187; SQL Server</title>
	<atom:link href="http://www.flexicoder.com/blog/index.php/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flexicoder.com/blog</link>
	<description></description>
	<lastBuildDate>Sat, 04 Feb 2012 12:24:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>SQL Server 2008 &#8211; Table Valued Parameters</title>
		<link>http://www.flexicoder.com/blog/index.php/2010/06/sql-server-2008-table-valued-parameters/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2010/06/sql-server-2008-table-valued-parameters/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 19:39:54 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[.Net security]]></category>
		<category><![CDATA[query syntax]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=329</guid>
		<description><![CDATA[Here is a great article that explains how to use TVP&#8217;s via .Net and a stored procedure Social Bookmarking]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sommarskog.se/arrays-in-sql-2008.html">Here</a> is a great article that explains how to use TVP&#8217;s via .Net and a stored procedure</p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2010/06/sql-server-2008-table-valued-parameters/&title=SQL+Server+2008+%26%238211%3B+Table+Valued+Parameters&text=Here+is+a+great+article+that+explains+how+to+use+TVP%26%238217%3Bs+via+.Net+and+a+stored+procedure...&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2010/06/sql-server-2008-table-valued-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Grant Execute for Stored Procs</title>
		<link>http://www.flexicoder.com/blog/index.php/2010/04/sql-grant-execute-for-stored-procs/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2010/04/sql-grant-execute-for-stored-procs/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 19:58:34 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[query syntax]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=308</guid>
		<description><![CDATA[Found this great article that has a really simple script to create the grant commands needed for all the procs in a database Social Bookmarking]]></description>
			<content:encoded><![CDATA[<p>Found this great <a href="http://yellowduckguy.spaces.live.com/Blog/cns!DA380C13569E8907!166.entry">article</a> that has a really simple script to create the grant commands needed for all the procs in a database</p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2010/04/sql-grant-execute-for-stored-procs/&title=SQL+Grant+Execute+for+Stored+Procs&text=Found+this+great+article+that+has+a+really+simple+script+to+create+the+grant+commands+needed+for+all+the+procs+in+a+database...&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2010/04/sql-grant-execute-for-stored-procs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing xml to use as search criteria in a query (optional parameters)</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/06/passing-xml-to-use-as-search-criteria-in-a-query-optional-parameters/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/06/passing-xml-to-use-as-search-criteria-in-a-query-optional-parameters/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 08:21:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[query syntax]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=46</guid>
		<description><![CDATA[We&#8217;ve had to generate a search facility for books on a site. The user types in any number of values and the results are ranked based on how many of the terms are actually found. The example below has a hard coded XML data, but obviously this would be passed in as a parameter, and [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve had to generate a search facility for books on a site. The user types in any number of values and the results are ranked based on how many of the terms are actually found.</p>
<p>The example below has a hard coded XML data, but obviously this would be passed in as a parameter, and as you build this externally you can include as many terms as you need.</p>
<p><code></p>
<pre class="brush: sql">
DECLARE @xml XML
SET @xml = '&lt;search&gt;
              &lt;term text="and" /&gt;
              &lt;term text="the" /&gt;
              &lt;term text="princess" /&gt;
              &lt;term text="9780719554285" /&gt;
            &lt;/search&gt;';

/* Use a CTE to load the terms into a table for later joining */
With MatchingTerms  (Term)
AS ( Select node.value('./@text', 'varchar(2000)') AS Term
        FROM @xml.nodes(N'//term') T(node))

SELECT  b.id,
            b.coverTitle,
            b.ISBN13,
            shortName as [binding],
            'B' as [type],
            count(id) as score
FROM    Book b,
           MatchingTerms x
WHERE
     b.coverTitle like '%' + x.Term + '%'
OR
     b.ISBN13 = x.Term
GROUP BY
     b.id,  b.coverTitle,  b.ISBN13, shortName</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/06/passing-xml-to-use-as-search-criteria-in-a-query-optional-parameters/&title=Passing+xml+to+use+as+search+criteria+in+a+query+%28optional+parameters%29&text=We%26%238217%3Bve+had+to+generate+a+search+facility+for+books+on+a+site.+The+user+types+in+any+number+of+values+and+the+results+are+ranked+based+on+how+many+of+the+terms+are+actually+found.&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/06/passing-xml-to-use-as-search-criteria-in-a-query-optional-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing SQL 2005 from Visual Studio 2008</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/05/accessing-sql-2005-from-visual-studio-2008/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/05/accessing-sql-2005-from-visual-studio-2008/#comments</comments>
		<pubDate>Thu, 07 May 2009 09:16:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=41</guid>
		<description><![CDATA[If you are attempting to add a data connection to a SQL 2005 database within visual studio 2008 you might encounter the following error&#8230; Could not load file or assembly ‘Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91′ or one of its dependencies. The system cannot find the file specified. You need to install the following&#8230; Microsoft SQL Server [...]]]></description>
			<content:encoded><![CDATA[<p>If you are attempting to add a data connection to a SQL 2005 database within visual studio 2008 you might encounter the following error&#8230;</p>
<blockquote><p>Could not load file or assembly ‘Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91′ or one of its dependencies. The system cannot find the file specified.</p></blockquote>
<p>You need to install the following&#8230;</p>
<p><strong>Microsoft SQL Server System CLR Types <br />Microsoft SQL Server 2008 Management Objects</strong> </p>
<p>They can be found <a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=c6c3e9ef-ba29-4a43-8d69-a2bed18fe73c&#038;displayLang=en">here</a> as part of the SQL Server 2008 Feature Pack.</p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/05/accessing-sql-2005-from-visual-studio-2008/&title=Accessing+SQL+2005+from+Visual+Studio+2008&text=If+you+are+attempting+to+add+a+data+connection+to+a+SQL+2005+database+within+visual+studio+2008+you+might+encounter+the+following+error%26%238230%3B+Could+not+load+file+or+assembly...&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/05/accessing-sql-2005-from-visual-studio-2008/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Differences between SCOPE_IDENTITY and @@IDENTITY</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/04/scope_identity-identity/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/04/scope_identity-identity/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 08:45:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[query syntax]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=39</guid>
		<description><![CDATA[@@IDENTITY will return the last id that was created using your connection, therefore if your insert kicks off a trigger you could get the wrong id. But SCOPE_INDENTITY() will return the last identity created Social Bookmarking]]></description>
			<content:encoded><![CDATA[<p>@@IDENTITY will return the last id that was created using your connection, therefore if your insert kicks off a trigger you could get the wrong id.</p>
<p>But SCOPE_INDENTITY() will return the last identity created</p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/04/scope_identity-identity/&title=Differences+between+SCOPE_IDENTITY+and+%40%40IDENTITY&text=%40%40IDENTITY+will+return+the+last+id+that+was+created+using+your+connection%2C+therefore+if+your+insert+kicks+off+a+trigger+you+could+get+the+wrong+id.&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/04/scope_identity-identity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delete with Inner join</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/03/delete-with-inner-join/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/03/delete-with-inner-join/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 11:22:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[query syntax]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=37</guid>
		<description><![CDATA[The following example shows how to perform a delete using an inner join DELETE a FROM StatementlineassociatedPayment AS a INNER JOIN rebatePatientStatementLine AS b ON a.StatementlineId = b.Id INNER JOIN rebatePatientSummary AS c ON b.summaryId = c.Id WHERE c.IssueStatus &#60;&#62; 2 Social Bookmarking]]></description>
			<content:encoded><![CDATA[<p>The following example shows how to perform a delete using an inner join</p>
<p><code>
<pre class="brush: sql">
DELETE
    a
FROM
    StatementlineassociatedPayment AS a
INNER JOIN
    rebatePatientStatementLine AS b
ON
    a.StatementlineId = b.Id
INNER JOIN
    rebatePatientSummary AS c
ON
    b.summaryId = c.Id
WHERE
    c.IssueStatus &lt;&gt; 2</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/03/delete-with-inner-join/&title=Delete+with+Inner+join&text=The+following+example+shows+how+to+perform+a+delete+using+an+inner+join+++DELETE+++++a+FROM+++++StatementlineassociatedPayment+AS+a+INNER+JOIN+++++rebatePatientStatementLine+AS+b+ON++++...&tags=inner+join" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/03/delete-with-inner-join/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CTE &#8211; Common Table Expression</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/02/cte-common-table-expression/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/02/cte-common-table-expression/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 19:48:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[query syntax]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=31</guid>
		<description><![CDATA[The following is an example of a CTE we have used WITH ProcessedTasks (PatientID, LowestTaskId) AS ( SELECT DISTINCT RebatePatientSummary.PatientId, MIN(RebatePayment.TaskEventId) AS Expr1 FROM StatementLineAssociatedPayment INNER JOIN RebatePayment ON StatementLineAssociatedPayment.RebatePaymentId = RebatePayment.Id INNER JOIN RebatePatientStatementLine ON StatementLineAssociatedPayment.StatementLineId = RebatePatientStatementLine.Id INNER JOIN RebatePatientSummary ON RebatePatientStatementLine.SummaryId = RebatePatientSummary.Id INNER JOIN TaskEvent ON RebatePayment.TaskEventId = TaskEvent.Id WHERE (RebatePatientSummary.IssueStatus [...]]]></description>
			<content:encoded><![CDATA[<p>The following is an example of a CTE we have used<br />
<code>
<pre class="brush:sql">
WITH ProcessedTasks (PatientID, LowestTaskId)
AS
(
SELECT DISTINCT
    RebatePatientSummary.PatientId,
    MIN(RebatePayment.TaskEventId) AS Expr1
FROM
    StatementLineAssociatedPayment
INNER JOIN
    RebatePayment
    ON StatementLineAssociatedPayment.RebatePaymentId = RebatePayment.Id
INNER JOIN
    RebatePatientStatementLine
    ON StatementLineAssociatedPayment.StatementLineId = RebatePatientStatementLine.Id
INNER JOIN
    RebatePatientSummary
    ON RebatePatientStatementLine.SummaryId = RebatePatientSummary.Id
INNER JOIN
    TaskEvent
    ON RebatePayment.TaskEventId = TaskEvent.Id
WHERE
    (RebatePatientSummary.IssueStatus = 2)
AND
    (RebatePayment.TaskEventId <> 0)
AND
    (TaskEvent.EventStatus = 5)
AND
    taskevent.rebateprocessed = 0
GROUP BY
    RebatePatientSummary.PatientId
)

SELECT
    t.Id,
    t.PatientId,
    t.RebateProcessed,
    p.lowestTaskId,
    t.SystemTaskId
FROM
    TaskEvent as t
INNER JOIN
    ProcessedTasks AS p
    ON t.PatientId = p.PatientId
AND
    t.Id <= p.LowestTaskId
WHERE
    EventStatus = 5
AND
    rebateprocessed = 0</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/02/cte-common-table-expression/&title=CTE+%26%238211%3B+Common+Table+Expression&text=The+following+is+an+example+of+a+CTE+we+have+used+++WITH+ProcessedTasks+%28PatientID%2C+LowestTaskId%29+AS+%28+SELECT+DISTINCT+++++RebatePatientSummary.PatientId%2C+++++MIN%28RebatePayment.TaskEventId%29+AS+Expr1...&tags=inner+join%2C+patientid%2C+taskevent%2C+inner%2C+rebatepayment%2C+rebatepatientsummary" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/02/cte-common-table-expression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Output Parameters with returned value</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/01/output-parameters-with-returned-value/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/01/output-parameters-with-returned-value/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 10:06:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[.Net code]]></category>
		<category><![CDATA[null]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=26</guid>
		<description><![CDATA[When using output parameter values you need to check that the value is not DBNull before using it&#8230; using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = System.Configuration.ConfigurationManager.AppSettings.Get("DBConnection").ToString(); conn.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = conn; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@ChapterId", _ChapterId)); cmd.Parameters.Add(new SqlParameter("@Sequence", _Sequence)); cmd.CommandText = "Get_ContentPrevNext"; SqlParameter parameterPreviousId = new [...]]]></description>
			<content:encoded><![CDATA[<p>When using output parameter values you need to check that the value is not DBNull before using it&#8230;</p>
<p><code>
<pre class="brush: c#">
using (SqlConnection conn = new SqlConnection())
{
    conn.ConnectionString = System.Configuration.ConfigurationManager.AppSettings.Get("DBConnection").ToString();
    conn.Open();
    using (SqlCommand cmd = new SqlCommand())
    {
        cmd.Connection = conn;
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add(new SqlParameter("@ChapterId", _ChapterId));
        cmd.Parameters.Add(new SqlParameter("@Sequence", _Sequence));
        cmd.CommandText = "Get_ContentPrevNext";
        SqlParameter parameterPreviousId = new SqlParameter("@PreviousId", System.Data.SqlDbType.Int)
        {
            Direction = System.Data.ParameterDirection.Output
        };
        cmd.Parameters.Add(parameterPreviousId);
        SqlParameter parameterNextId = new SqlParameter("@NextId", System.Data.SqlDbType.Int)
        {
            Direction = System.Data.ParameterDirection.Output
        };
        cmd.Parameters.Add(parameterNextId);
        cmd.ExecuteNonQuery();
        if (parameterPreviousId.Value != DBNull.Value)
        {
            _PreviousId = Convert.ToInt32(parameterPreviousId.Value);
        }
        if (parameterNextId.Value != DBNull.Value)
        {
            _NextId = Convert.ToInt32(parameterNextId.Value);
        }
    }
}</pre>
<p></code></p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/01/output-parameters-with-returned-value/&title=Output+Parameters+with+returned+value&text=When+using+output+parameter+values+you+need+to+check+that+the+value+is+not+DBNull+before+using+it%26%238230%3B+++using+%28SqlConnection+conn+%3D+new+SqlConnection%28%29%29+%7B+++++conn.ConnectionString+%3D...&tags=cmd+parameters%2C+new+sqlparameter%2C+value%2C+sqlparameter%2C+system" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/01/output-parameters-with-returned-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading Image/BLOB from SQL Server</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/01/loading-imageblob-from-sql-server/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/01/loading-imageblob-from-sql-server/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 11:18:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[C# 3.5]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[.Net code]]></category>
		<category><![CDATA[Image]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=23</guid>
		<description><![CDATA[If you have an image column in your SQL table you can load the bytes using the following code. int bufferSize = Convert.ToInt32(reader.GetBytes(7,0,null,0,int.MaxValue)); _ThumbnailImage = new Byte[bufferSize]; reader.GetBytes(7, 0, _ThumbnailImage, 0, bufferSize); The first parameter is the column number, in this case 7, call GetBytes with a null buffer first to get the number of [...]]]></description>
			<content:encoded><![CDATA[<p>If you have an <em>image </em>column in your SQL table you can load the bytes using the following code.<br />
<code>
<pre class="brush:c#">
int bufferSize = Convert.ToInt32(reader.GetBytes(7,0,null,0,int.MaxValue));
_ThumbnailImage = new Byte[bufferSize];
reader.GetBytes(7, 0, _ThumbnailImage, 0, bufferSize);
</pre>
<p></code><br />
The first parameter is the column number, in this case 7, call <em>GetBytes </em>with a null buffer first to get the number of bytes needed.</p>
<p>Remember that an <em>image </em>column, holds bytes and therefore can contain any sort of document, not necessarily an image, could be a PDF</p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/01/loading-imageblob-from-sql-server/&title=Loading+Image%2FBLOB+from+SQL+Server&text=If+you+have+an+image+column+in+your+SQL+table+you+can+load+the+bytes+using+the+following+code.+++int+bufferSize+%3D+Convert.ToInt32%28reader.GetBytes%287%2C0%2Cnull%2C0%2Cint.MaxValue%29%29%3B+_ThumbnailImage+%3D+new...&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/01/loading-imageblob-from-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TRUNCATE TABLE &#8211; execute permissions</title>
		<link>http://www.flexicoder.com/blog/index.php/2009/01/truncate-table-execute-permissions/</link>
		<comments>http://www.flexicoder.com/blog/index.php/2009/01/truncate-table-execute-permissions/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 15:01:00 +0000</pubDate>
		<dc:creator>flexicoder</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[query syntax]]></category>

		<guid isPermaLink="false">http://www.flexicoder.com/blog/?p=21</guid>
		<description><![CDATA[In SQL 2005 you can now use WITH EXECUTE AS to allow a normal user to truncate tables. It basically means they run the specificed procedure with higher rights than they have. CREATE PROCEDURE TruncateMyTable WITH EXECUTE AS OWNER AS TRUNCATE TABLE MyDB..MyTable; See MSDN for more details. Social Bookmarking]]></description>
			<content:encoded><![CDATA[<p>In SQL 2005 you can now use <em>WITH EXECUTE AS </em>to allow a normal user to truncate tables. It basically means they run the specificed procedure with higher rights than they have.</p>
<p><code>
<pre class="brush: sql">
CREATE PROCEDURE TruncateMyTable
WITH EXECUTE AS OWNER
AS TRUNCATE TABLE MyDB..MyTable;
</pre>
<p></code></p>
<p>See <a href="http://msdn.microsoft.com/en-us/library/ms190384(SQL.90).aspx">MSDN</a> for more details.</p>
<br/><a href="http://www.socialmarker.com/?link=http://www.flexicoder.com/blog/index.php/2009/01/truncate-table-execute-permissions/&title=TRUNCATE+TABLE+%26%238211%3B+execute+permissions&text=In+SQL+2005+you+can+now+use+WITH+EXECUTE+AS+to+allow+a+normal+user+to+truncate+tables.+It+basically+means+they+run+the+specificed+procedure+with+higher+rights+than+they+have.&tags=" target="_blank"><img src= "http://www.socialmarker.com/bookmark.gif" border="0" /></a><noscript><a href="http://www.socialmarker.com" >Social Bookmarking</a></noscript>]]></content:encoded>
			<wfw:commentRss>http://www.flexicoder.com/blog/index.php/2009/01/truncate-table-execute-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

