declare @col varchar(255), @cmd varchar(max)
DECLARE getinfo cursor for
SELECT c.name FROM sys.tables t JOIN sys.columns c ON t.Object_ID = c.Object_ID
WHERE t.Name = 'ADDR_Address'
OPEN getinfo
FETCH NEXT FROM getinfo into @col
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @cmd = 'IF NOT EXISTS (SELECT top 1 * FROM ADDR_Address WHERE [' + @col + '] IS NOT NULL) BEGIN print ''' + @col + ''' end'
EXEC(@cmd)
FETCH NEXT FROM getinfo into @col
END
CLOSE getinfo
DEALLOCATE getinfo
I have created this blog to help programmers who have just started their career thats why I have written all the tutorials from practical approach rather then theoretical. If anyone has any query related to programming don't hesitate to ask. My contact information is in my profile. Also I would like to thank all the websites/Individual(s) from whom I gathered the material.
Thursday, November 17, 2011
SQL - Get All Columns in a Table That Contains NULL
Posted by
Zeeshan Ahmed Khan
at
11/17/2011 04:36:00 PM
Labels:
columns,
list,
ms sql-server,
NULL,
server,
sql,
sql server,
sql-server,
table
Friday, November 11, 2011
Redirect All Request to Another URL Programmatically
The following code samples configure the Default Web Site to redirect all requests to "http://www.contoso.com" using an HTTP 302 status code.
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
{
private static void Main()
{
using (ServerManager serverManager = new ServerManager())
{
Configuration config = serverManager.GetWebConfiguration("Default Web Site");
ConfigurationSection httpRedirectSection = config.GetSection("system.webServer/httpRedirect");
httpRedirectSection["enabled"] = true;
httpRedirectSection["destination"] = @"http://www.contoso.com";
httpRedirectSection["exactDestination"] = false;
httpRedirectSection["httpResponseStatus"] = @"Found";
serverManager.CommitChanges();
}
}
}
Subscribe to:
Posts (Atom)