<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments for Journey to SQL Authority with Pinal Dave</title>
	<atom:link href="http://blog.sqlauthority.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com</link>
	<description>Notes of a SQL Server MVP and Database Administrator</description>
	<lastBuildDate>Fri, 20 Nov 2009 20:17:18 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on SQL SERVER &#8211; Get Current Database Name by Bruno Oliveira</title>
		<link>http://blog.sqlauthority.com/2008/02/12/sql-server-get-current-database-name/#comment-57780</link>
		<dc:creator>Bruno Oliveira</dc:creator>
		<pubDate>Fri, 20 Nov 2009 20:17:18 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=503#comment-57780</guid>
		<description>Grande Givanildo!!!!</description>
		<content:encoded><![CDATA[<p>Grande Givanildo!!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; ReIndexing Database Tables and Update Statistics on Tables by Matt</title>
		<link>http://blog.sqlauthority.com/2007/01/31/sql-server-reindexing-database-tables-and-update-statistics-on-tables/#comment-57779</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Fri, 20 Nov 2009 18:30:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/01/31/reindexing-database-tables-and-update-statistics-on-tables/#comment-57779</guid>
		<description>Fact is, the more often you reindex the less fragmented your indexes will be, and the less fragmented they are the faster performance you&#039;ll see.  I reindex nightly and can afford a little downtime for my bigger tables, in the middle of the night.  This keeps my users happy in the daytime.

If outage is an issue then seriously look into the SQL Enterprise license, it allows online reindexing.  It&#039;s pricey, though, at around $20k/proc.</description>
		<content:encoded><![CDATA[<p>Fact is, the more often you reindex the less fragmented your indexes will be, and the less fragmented they are the faster performance you&#8217;ll see.  I reindex nightly and can afford a little downtime for my bigger tables, in the middle of the night.  This keeps my users happy in the daytime.</p>
<p>If outage is an issue then seriously look into the SQL Enterprise license, it allows online reindexing.  It&#8217;s pricey, though, at around $20k/proc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; Get Time in Hour:Minute Format from a Datetime &#8211; Get Date Part Only from Datetime by Donna</title>
		<link>http://blog.sqlauthority.com/2009/08/06/sql-server-get-time-in-hourminute-format-from-a-datetime-get-date-part-only-from-datetime/#comment-57777</link>
		<dc:creator>Donna</dc:creator>
		<pubDate>Fri, 20 Nov 2009 17:00:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5940#comment-57777</guid>
		<description>Hello all - I am a newbie,
can someone tell me how do I modify this to remove the &#039;AM&#039; from the result

SELECT CONVERT(VARCHAR(10), DATEADD(d,+1,GETDATE()),101)+ &#039; &#039; + RIGHT (CONVERT(VARCHAR, GETDATE(), 100),7)</description>
		<content:encoded><![CDATA[<p>Hello all &#8211; I am a newbie,<br />
can someone tell me how do I modify this to remove the &#8216;AM&#8217; from the result</p>
<p>SELECT CONVERT(VARCHAR(10), DATEADD(d,+1,GETDATE()),101)+ &#8216; &#8216; + RIGHT (CONVERT(VARCHAR, GETDATE(), 100),7)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; FIX : ERROR : Cannot open database requested by the login. The login failed. Login failed for user &#8216;NT AUTHORITY\NETWORK SERVICE&#8217;. by Nonso</title>
		<link>http://blog.sqlauthority.com/2009/08/20/sql-server-fix-error-cannot-open-database-requested-by-the-login-the-login-failed-login-failed-for-user-nt-authoritynetwork-service/#comment-57776</link>
		<dc:creator>Nonso</dc:creator>
		<pubDate>Fri, 20 Nov 2009 16:45:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6622#comment-57776</guid>
		<description>Thanks man.. you are the best..
The tip worked like charm..</description>
		<content:encoded><![CDATA[<p>Thanks man.. you are the best..<br />
The tip worked like charm..</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; Size of Index Table &#8211; A Puzzle to Find Index Size for Each Index on Table by Adam Hutson</title>
		<link>http://blog.sqlauthority.com/2009/11/18/sql-server-size-of-index-table-a-puzzle-to-find-index-size-for-each-index-on-table/#comment-57774</link>
		<dc:creator>Adam Hutson</dc:creator>
		<pubDate>Fri, 20 Nov 2009 14:57:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7388#comment-57774</guid>
		<description>DECLARE 
	@objname nvarchar(776), 
	@id int, 
	@dbname sysname 
	
SELECT 
	@objname = &#039;TableToExamine&#039;,
	@dbname = ISNULL(parsename(@objname, 3),DB_NAME()),
	@id = object_id(@objname)

SELECT 
	i.*,
	CASE 
		WHEN ps.usedpages &gt; ps.pages THEN (ps.usedpages - ps.pages) 
		ELSE 0 
	END * 8 indexsize
FROM sys.indexes i
INNER JOIN (
	SELECT  
		OBJECT_ID,
		index_id,
		SUM (used_page_count) usedpages,
		SUM (
			CASE
				WHEN (index_id &lt; 2) THEN (in_row_data_page_count + lob_used_page_count + row_overflow_used_page_count)
				ELSE lob_used_page_count + row_overflow_used_page_count
			END
		)pages
	FROM sys.dm_db_partition_stats
	WHERE object_id = @id
	GROUP BY object_id, index_id
) ps on i.index_id = ps.index_id
WHERE i.object_id = @id</description>
		<content:encoded><![CDATA[<p>DECLARE<br />
	@objname nvarchar(776),<br />
	@id int,<br />
	@dbname sysname </p>
<p>SELECT<br />
	@objname = &#8216;TableToExamine&#8217;,<br />
	@dbname = ISNULL(parsename(@objname, 3),DB_NAME()),<br />
	@id = object_id(@objname)</p>
<p>SELECT<br />
	i.*,<br />
	CASE<br />
		WHEN ps.usedpages &gt; ps.pages THEN (ps.usedpages &#8211; ps.pages)<br />
		ELSE 0<br />
	END * 8 indexsize<br />
FROM sys.indexes i<br />
INNER JOIN (<br />
	SELECT<br />
		OBJECT_ID,<br />
		index_id,<br />
		SUM (used_page_count) usedpages,<br />
		SUM (<br />
			CASE<br />
				WHEN (index_id &lt; 2) THEN (in_row_data_page_count + lob_used_page_count + row_overflow_used_page_count)<br />
				ELSE lob_used_page_count + row_overflow_used_page_count<br />
			END<br />
		)pages<br />
	FROM sys.dm_db_partition_stats<br />
	WHERE object_id = @id<br />
	GROUP BY object_id, index_id<br />
) ps on i.index_id = ps.index_id<br />
WHERE i.object_id = @id</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Contact Me by deep</title>
		<link>http://blog.sqlauthority.com/contact-me-contact-pinaldave/#comment-57772</link>
		<dc:creator>deep</dc:creator>
		<pubDate>Fri, 20 Nov 2009 11:17:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?page_id=6010#comment-57772</guid>
		<description>hi pinal,

please give same way to tuning a SP.</description>
		<content:encoded><![CDATA[<p>hi pinal,</p>
<p>please give same way to tuning a SP.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; 2008 &#8211; Insert Multiple Records Using One Insert Statement &#8211; Use of Row Constructor by Antonio</title>
		<link>http://blog.sqlauthority.com/2008/07/02/sql-server-2008-insert-multiple-records-using-one-insert-statement-use-of-row-constructor/#comment-57771</link>
		<dc:creator>Antonio</dc:creator>
		<pubDate>Fri, 20 Nov 2009 11:17:34 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=668#comment-57771</guid>
		<description>With sql server CE this query:

INSERT INTO Scontistica 
               (Prodotto,Sconto)
values (&#039;Sky&#039;,0.5),
          (&#039;Skywarm&#039;,0.5)

give me this error:
[ Token line number = 2,Token line offset = 19,Token in error = , ]

why??</description>
		<content:encoded><![CDATA[<p>With sql server CE this query:</p>
<p>INSERT INTO Scontistica<br />
               (Prodotto,Sconto)<br />
values (&#8216;Sky&#8217;,0.5),<br />
          (&#8216;Skywarm&#8217;,0.5)</p>
<p>give me this error:<br />
[ Token line number = 2,Token line offset = 19,Token in error = , ]</p>
<p>why??</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; 2005 &#8211; List All Stored Procedure Modified in Last N Days by kuldeep chanchal</title>
		<link>http://blog.sqlauthority.com/2007/07/10/sql-server-2005-list-all-stored-procedure-modified-in-last-n-days/#comment-57770</link>
		<dc:creator>kuldeep chanchal</dc:creator>
		<pubDate>Fri, 20 Nov 2009 11:02:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/10/sql-server-2005-list-all-stored-procedure-modified-in-last-n-days/#comment-57770</guid>
		<description>hi pinal

i am new to sql server, and needs to tune one SP.
is there any way to find when any specific database last reindexed?</description>
		<content:encoded><![CDATA[<p>hi pinal</p>
<p>i am new to sql server, and needs to tune one SP.<br />
is there any way to find when any specific database last reindexed?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; Get Common Records From Two Tables Without Using Join by amit</title>
		<link>http://blog.sqlauthority.com/2008/10/17/sql-server-get-common-records-from-two-tables-without-using-join/#comment-57769</link>
		<dc:creator>amit</dc:creator>
		<pubDate>Fri, 20 Nov 2009 10:34:07 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1380#comment-57769</guid>
		<description>Hello sir i m using sql 2000 in asp.net, i want to download a file from two tables indivuadually but i can do but i want from 2 tables Q1 and Q2, and download in csv format? wat can i do sir plz help me send me a mail regarding this thanks</description>
		<content:encoded><![CDATA[<p>Hello sir i m using sql 2000 in asp.net, i want to download a file from two tables indivuadually but i can do but i want from 2 tables Q1 and Q2, and download in csv format? wat can i do sir plz help me send me a mail regarding this thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; Definition, Comparison and Difference between HAVING and WHERE Clause by Someshwar</title>
		<link>http://blog.sqlauthority.com/2007/07/04/sql-server-definition-comparison-and-difference-between-having-and-where-clause/#comment-57768</link>
		<dc:creator>Someshwar</dc:creator>
		<pubDate>Fri, 20 Nov 2009 09:32:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/04/sql-server-definition-comparison-and-difference-between-having-and-where-clause/#comment-57768</guid>
		<description>Nice explanation, easily understandable , thanks a lot</description>
		<content:encoded><![CDATA[<p>Nice explanation, easily understandable , thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; Understanding Table Hints with Examples by Gangadhar Naidu</title>
		<link>http://blog.sqlauthority.com/2009/11/19/sql-server-understanding-table-hints-with-examples/#comment-57766</link>
		<dc:creator>Gangadhar Naidu</dc:creator>
		<pubDate>Fri, 20 Nov 2009 09:01:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7113#comment-57766</guid>
		<description>Hi Pinal,

You explained very well about hints. But you need to conclude which hint is better.</description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>You explained very well about hints. But you need to conclude which hint is better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; 2008 &#8211; 2005 &#8211; Find Longest Running Query &#8211; TSQL &#8211; Part 2 by bhaskar</title>
		<link>http://blog.sqlauthority.com/2009/01/23/sql-server-2008-2005-find-longest-running-query-tsql-part-2/#comment-57764</link>
		<dc:creator>bhaskar</dc:creator>
		<pubDate>Fri, 20 Nov 2009 07:25:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2105#comment-57764</guid>
		<description>Hi,

Please add the hostname with this query.
I am not able to join sysprocess for hostname with this query.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Please add the hostname with this query.<br />
I am not able to join sysprocess for hostname with this query.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; 2008 &#8211; 2005 &#8211; Find Longest Running Query &#8211; TSQL &#8211; Part 2 by Bhaskar</title>
		<link>http://blog.sqlauthority.com/2009/01/23/sql-server-2008-2005-find-longest-running-query-tsql-part-2/#comment-57763</link>
		<dc:creator>Bhaskar</dc:creator>
		<pubDate>Fri, 20 Nov 2009 07:00:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2105#comment-57763</guid>
		<description>Hi ,

Is there any method to get the host name with this query?
I am not able to connect this with sysprocesses to get the hostname.
Please help.</description>
		<content:encoded><![CDATA[<p>Hi ,</p>
<p>Is there any method to get the host name with this query?<br />
I am not able to connect this with sysprocesses to get the hostname.<br />
Please help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; Cannot resolve collation conflict for equal to operation by Nigar</title>
		<link>http://blog.sqlauthority.com/2007/06/11/sql-server-cannot-resolve-collation-conflict-for-equal-to-operation/#comment-57762</link>
		<dc:creator>Nigar</dc:creator>
		<pubDate>Fri, 20 Nov 2009 06:03:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/11/sql-server-cannot-resolve-collation-conflict-for-equal-to-operation/#comment-57762</guid>
		<description>Hello!
Could you help me to figure that out:

select count(distinct a.[9060_SubsId])
from ([CDR-OCT-2009].dbo.[CDR_Oct2009],
      [CDR-NOV-2009].dbo.[CDR_Nov2009]) a
where ChargeableDuration&gt;&#039;0&#039;
  and OriginateTime BETWEEN &#039;2009-11-01&#039; and &#039;2009-11-18 23:59&#039;</description>
		<content:encoded><![CDATA[<p>Hello!<br />
Could you help me to figure that out:</p>
<p>select count(distinct a.[9060_SubsId])<br />
from ([CDR-OCT-2009].dbo.[CDR_Oct2009],<br />
      [CDR-NOV-2009].dbo.[CDR_Nov2009]) a<br />
where ChargeableDuration&gt;&#8217;0&#8242;<br />
  and OriginateTime BETWEEN &#8216;2009-11-01&#8242; and &#8216;2009-11-18 23:59&#8242;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQLAuthority News &#8211; Book Review &#8211; Expert SQL Server 2008 Encryption by Michael Coles by Ritesh Shah</title>
		<link>http://blog.sqlauthority.com/2009/11/20/sqlauthority-news-book-review-expert-sql-server-2008-encryption-by-michael-coles/#comment-57761</link>
		<dc:creator>Ritesh Shah</dc:creator>
		<pubDate>Fri, 20 Nov 2009 05:48:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7382#comment-57761</guid>
		<description>Hi Pinal,

You are really raising my temptation to read this book. Since I like the enhancement of encryption and decryption in Microsoft SQL Server 2005+, this seems MUST read book for me. 

BTW, my mind&#039;s battery is fully charged after one short vacation now so thinking to start reading this book ASAP.</description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>You are really raising my temptation to read this book. Since I like the enhancement of encryption and decryption in Microsoft SQL Server 2005+, this seems MUST read book for me. </p>
<p>BTW, my mind&#8217;s battery is fully charged after one short vacation now so thinking to start reading this book ASAP.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; Create a Comma Delimited List Using SELECT Clause From Table Column by Tejas Shah</title>
		<link>http://blog.sqlauthority.com/2008/06/04/sql-server-create-a-comma-delimited-list-using-select-clause-from-table-column/#comment-57760</link>
		<dc:creator>Tejas Shah</dc:creator>
		<pubDate>Fri, 20 Nov 2009 05:42:07 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=631#comment-57760</guid>
		<description>Hi Vikram,

You can do this as:

DECLARE @str VARCHAR(100)
SELECT @str = &#039;12345678,abcdefgh&#039;

SELECT	@str,
		SUBSTRING(@str, 0 , CHARINDEX(&#039;,&#039;,@str)) AS [1stColunmn],
		SUBSTRING(@str, CHARINDEX(&#039;,&#039;,@str) + 1, LEN(@str)) AS [2ndColumn]

Thanks,

Tejas</description>
		<content:encoded><![CDATA[<p>Hi Vikram,</p>
<p>You can do this as:</p>
<p>DECLARE @str VARCHAR(100)<br />
SELECT @str = &#8216;12345678,abcdefgh&#8217;</p>
<p>SELECT	@str,<br />
		SUBSTRING(@str, 0 , CHARINDEX(&#8216;,&#8217;,@str)) AS [1stColunmn],<br />
		SUBSTRING(@str, CHARINDEX(&#8216;,&#8217;,@str) + 1, LEN(@str)) AS [2ndColumn]</p>
<p>Thanks,</p>
<p>Tejas</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; Difference between DISTINCT and GROUP BY &#8211; Distinct vs Group By by Asharaf Ali</title>
		<link>http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-57759</link>
		<dc:creator>Asharaf Ali</dc:creator>
		<pubDate>Fri, 20 Nov 2009 05:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/03/29/difference-between-distinct-and-group-by-distinct-vs-group-by/#comment-57759</guid>
		<description>Thanks
useful info</description>
		<content:encoded><![CDATA[<p>Thanks<br />
useful info</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; 2008 &#8211; Fix Connection Error with Visual Studio 2008 &#8211; Server Version is not supported by sarita</title>
		<link>http://blog.sqlauthority.com/2008/09/21/sql-server-2008-fix-connection-error-with-visual-studio-2008-server-version-is-not-supported/#comment-57758</link>
		<dc:creator>sarita</dc:creator>
		<pubDate>Fri, 20 Nov 2009 05:10:08 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1153#comment-57758</guid>
		<description>sir i had installed visual studio 2008 and when i am creating an database it is giving me an error that connection microsoft sql server express edition.I dont know what to do.Please i need ur help.</description>
		<content:encoded><![CDATA[<p>sir i had installed visual studio 2008 and when i am creating an database it is giving me an error that connection microsoft sql server express edition.I dont know what to do.Please i need ur help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL SERVER &#8211; 2008 &#8211; Download and Install Samples Database AdventureWorks 2005 &#8211; Detail Tutorial by Diana Le</title>
		<link>http://blog.sqlauthority.com/2008/08/10/sql-server-2008-download-and-install-samples-database-adventureworks-2005-detail-tutorial/#comment-57757</link>
		<dc:creator>Diana Le</dc:creator>
		<pubDate>Fri, 20 Nov 2009 04:54:35 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=802#comment-57757</guid>
		<description>Nusrath,

I initially had the same problem with developer.  What I did was completely uninstall all editions of SQL (I had some Express versions in there I think).  I even deleted any leftover folders after I uninstalled everything.  Restart the computer.  Once I did that, I created an account with just user privileges.  I reinstalled SQL 2008 and made sure that for the full-text daemon login/password I put in my new user with limited privileges (this is during the installation process).  I had no errors this time around and was able to install AdventureWorks successfully.

Of course I probably did not need to uninstall everything, but I just wanted to make sure that I started with a clean slate.  You could probably be able to do the same thing by simply creating a user with limited privileges and change the server settings from there.

P.S I am using Windows XP Professional

Diana</description>
		<content:encoded><![CDATA[<p>Nusrath,</p>
<p>I initially had the same problem with developer.  What I did was completely uninstall all editions of SQL (I had some Express versions in there I think).  I even deleted any leftover folders after I uninstalled everything.  Restart the computer.  Once I did that, I created an account with just user privileges.  I reinstalled SQL 2008 and made sure that for the full-text daemon login/password I put in my new user with limited privileges (this is during the installation process).  I had no errors this time around and was able to install AdventureWorks successfully.</p>
<p>Of course I probably did not need to uninstall everything, but I just wanted to make sure that I started with a clean slate.  You could probably be able to do the same thing by simply creating a user with limited privileges and change the server settings from there.</p>
<p>P.S I am using Windows XP Professional</p>
<p>Diana</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Contact Me by Amitabh Bachan.</title>
		<link>http://blog.sqlauthority.com/contact-me-contact-pinaldave/#comment-57756</link>
		<dc:creator>Amitabh Bachan.</dc:creator>
		<pubDate>Fri, 20 Nov 2009 03:57:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?page_id=6010#comment-57756</guid>
		<description>Okay, I did this but I was able to inject (both delete and drop table statement worked.). Can you please a solution on sp_executesql. Yes, I did LOTS OF GOOGLE FOR PAST 8 HOURS WITH NO LUCK... THANKS

CREATE PROCEDURE uspGetEmployee
@LastName VARCHAR(50) = NULL
AS
BEGIN
SET NOCOUNT ON;
DECLARE @sql NVARCHAR(300)        
SELECT @sql = &#039; SELECT * &#039; + &#039; FROM EMPLOYEES 
			WHERE 1=1 &#039;
IF @LastName	IS NOT NULL
	SELECT @sql = @sql + &#039; AND [LASTNAME] = @LastName&#039;
EXEC sp_executesql @sql, N&#039;@lastname VARCHAR(50)&#039;, @LastName
end
GO

Here is how I deleted and drop the table...

DECLARE @RC int
DECLARE @LastName varchar(50)
EXECUTE @RC = [Northwind].[dbo].[uspGetEmployee] 
   delete from employees where lastname=&#039;king&#039;</description>
		<content:encoded><![CDATA[<p>Okay, I did this but I was able to inject (both delete and drop table statement worked.). Can you please a solution on sp_executesql. Yes, I did LOTS OF GOOGLE FOR PAST 8 HOURS WITH NO LUCK&#8230; THANKS</p>
<p>CREATE PROCEDURE uspGetEmployee<br />
@LastName VARCHAR(50) = NULL<br />
AS<br />
BEGIN<br />
SET NOCOUNT ON;<br />
DECLARE @sql NVARCHAR(300)<br />
SELECT @sql = &#8216; SELECT * &#8216; + &#8216; FROM EMPLOYEES<br />
			WHERE 1=1 &#8216;<br />
IF @LastName	IS NOT NULL<br />
	SELECT @sql = @sql + &#8216; AND [LASTNAME] = @LastName&#8217;<br />
EXEC sp_executesql @sql, N&#8217;@lastname VARCHAR(50)&#8217;, @LastName<br />
end<br />
GO</p>
<p>Here is how I deleted and drop the table&#8230;</p>
<p>DECLARE @RC int<br />
DECLARE @LastName varchar(50)<br />
EXECUTE @RC = [Northwind].[dbo].[uspGetEmployee]<br />
   delete from employees where lastname=&#8217;king&#8217;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
