<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Comments on snippet: 'Sql Queries'</title>
    <description>Snipplr comments feed</description>
    <link>https://snipplr.com/</link>
    <lastBuildDate>Tue, 09 Jun 2026 08:45:47 +0000</lastBuildDate>
    <item>
      <title>hairajeshk said on 11/Jan/2011</title>
      <link>https://snipplr.com/view/46238/sql-queries</link>
      <description>&lt;p&gt;Drop all stored procs using Cursor:&#13;
Alter Procedure dbo.DeleteAllProcedures&#13;
As&#13;
      declare @procName varchar(500)&#13;
      declare cur cursor &#13;
            for select [name] from sys.objects where type = 'p'&#13;
      open cur&#13;
 &#13;
&#13;
      fetch next from cur into @procName&#13;
      while @@fetch_status = 0&#13;
      begin&#13;
            if @procName  'DeleteAllProcedures'&#13;
                  exec('drop procedure ' + @procName)&#13;
                  fetch next from cur into @procName&#13;
      end&#13;
      close cur&#13;
      deallocate cur&#13;
Go&#13;
      Grant Execute On dbo.DeleteAllProcedures To Public&#13;
Go&lt;/p&gt;</description>
      <pubDate>Tue, 11 Jan 2011 16:20:26 UTC</pubDate>
      <guid>https://snipplr.com/view/46238/sql-queries</guid>
    </item>
    <item>
      <title>hairajeshk said on 11/Jan/2011</title>
      <link>https://snipplr.com/view/46238/sql-queries</link>
      <description>&lt;p&gt;loop through all/selected databases using sp_MSforeachdb system stored procedure or loop through all/selected user tables using sp_MSforeachtable system stored procedure:&#13;
http://www.mssqltips.com/tip.asp?tip=1905&lt;/p&gt;</description>
      <pubDate>Tue, 11 Jan 2011 16:22:51 UTC</pubDate>
      <guid>https://snipplr.com/view/46238/sql-queries</guid>
    </item>
    <item>
      <title>hairajeshk said on 02/Feb/2011</title>
      <link>https://snipplr.com/view/46238/sql-queries</link>
      <description>&lt;p&gt;To find a column in all the tables of database&#13;
SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name = 'Pricelistname' )&lt;/p&gt;</description>
      <pubDate>Wed, 02 Feb 2011 20:23:03 UTC</pubDate>
      <guid>https://snipplr.com/view/46238/sql-queries</guid>
    </item>
    <item>
      <title>hairajeshk said on 18/Feb/2011</title>
      <link>https://snipplr.com/view/46238/sql-queries</link>
      <description>&lt;p&gt;Check for both NULL and Empty in one statement::&#13;
&#13;
IF ISNULL(@text, '') = ''&lt;/p&gt;</description>
      <pubDate>Fri, 18 Feb 2011 19:32:17 UTC</pubDate>
      <guid>https://snipplr.com/view/46238/sql-queries</guid>
    </item>
    <item>
      <title>hairajeshk said on 15/Mar/2011</title>
      <link>https://snipplr.com/view/46238/sql-queries</link>
      <description>&lt;p&gt;Update 0 with ones and 1 with 0 in a single query&#13;
&#13;
Update #tblx SET x=&#13;
( case when x=1 then 0&#13;
   when x=0 then 1	&#13;
	else x&#13;
	end )&lt;/p&gt;</description>
      <pubDate>Tue, 15 Mar 2011 18:05:01 UTC</pubDate>
      <guid>https://snipplr.com/view/46238/sql-queries</guid>
    </item>
    <item>
      <title>hairajeshk said on 15/Mar/2011</title>
      <link>https://snipplr.com/view/46238/sql-queries</link>
      <description>&lt;p&gt;Returns all the customer names which doesn't start with alphabet&#13;
&#13;
select customername from customer where customername like '[^A-Z]%'&#13;
This example finds the rows for authors with last names of Carson, Carsen, Karson, or Karsen.&#13;
 USE pubs&#13;
GO&#13;
SELECT au_lname, au_fname, phone&#13;
FROM authors&#13;
WHERE au_lname LIKE '[CK]ars[eo]n'&#13;
ORDER BY au_lname ASC, au_fname ASC&#13;
GO&lt;/p&gt;</description>
      <pubDate>Tue, 15 Mar 2011 20:15:14 UTC</pubDate>
      <guid>https://snipplr.com/view/46238/sql-queries</guid>
    </item>
  </channel>
</rss>
