Wednesday, September 24, 2014

Dropping all views, stored procedure and functions


Dropping all the views

1. Get all the views
select name from sys.objects where type='v' order by name

2. Drop all the views

DECLARE @viewName varchar(500)
DECLARE cur CURSOR
      FOR SELECT [name] FROM sys.objects WHERE type in ('V')
      OPEN cur

      FETCH NEXT FROM cur INTO @viewName
      WHILE @@fetch_status = 0
      BEGIN
            EXEC('DROP VIEW ' + @viewName)
Select @viewName
            FETCH NEXT FROM cur INTO @viewName
      END
      CLOSE cur
      DEALLOCATE cur


Dropping all the stored procedures

1. Display all the stored procedure.
Select name from sys.objects where type='p' order by name

2. Drop all the stored procedure

DECLARE @viewName varchar(500)
DECLARE cur CURSOR
      FOR SELECT [name] FROM sys.objects WHERE type in ('P')
      OPEN cur

      FETCH NEXT FROM cur INTO @viewName
      WHILE @@fetch_status = 0
      BEGIN
            EXEC('DROP PROCEDURE ' + @viewName)
Select @viewName
            FETCH NEXT FROM cur INTO @viewName
      END
      CLOSE cur
      DEALLOCATE cur


Dropping all the functions

1. Display all the existing functions
 select name from sys.objects where type='TF' or type='IF' or type='FN' order by name

2. Drop all the existing functions

DECLARE @viewName varchar(500)
DECLARE cur CURSOR
      FOR SELECT [name] FROM sys.objects WHERE type in ('TF','IF','FN')
      OPEN cur

      FETCH NEXT FROM cur INTO @viewName
      WHILE @@fetch_status = 0
      BEGIN
            EXEC('DROP Function ' + @viewName)
Select @viewName
            FETCH NEXT FROM cur INTO @viewName
      END
      CLOSE cur
      DEALLOCATE cur



TFS computer name change

Update TFS workspace when computer name changes


C:\Program Files (x86)\Microsoft Visual Studio 11.0>tf workspaces /updateCompute
rname:TJZR9XNH9H TJZR9XNH9H /s:http://tocgjtim1pv:8080/tfs/SR2012_Collection


Here
updateComputerrname:TJZR9XNH9H ----------------  TJZR9XNH9H is old computer name
TJZR9XNH9H --------------------------------------------  workspace name
http://tocgjtim1pv:8080/tfs/ ------------------------------ TFS url
SR2012_Collection ---------------------------------------  Collection name


Monday, September 15, 2014

Configuring ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005

1. Create a database named 'aspnetdb'.
2. execute following exe to command prompt
c:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql.exe
3.