Monthly Archives: January 2012

SQL Server- Output clause

By | January 22, 2012

Output Clause:- The SQL SERVER 2005 gives us an Output Clause which gives us the information about each row affected by the Insert, Update , Delete and Merge statement. It is more useful than @@scope_Identity and @@Identity column since these global variables gives us the information about the last inserted identity column value, but the Output clause gives us… Read More »

SQL Server – Local temporary table

By | January 7, 2012

Local temporary table:- Local temporary table is created in the tempdb and it is visible to the current user’s session only. It remains exists till the current user session is connected. Once the user connection is disconnected it gets destroyed. Since the local temporary table is created in the tempdb, whenever we use temporary tables… Read More »

SQL Server – Global temporary tables

By | January 7, 2012

Global temporary table:- Global temporary table is created in the tempdb  and it is visible to all other sessions as well. Global temporary tables are only destroyed when the current user disconnected and all the sessions referring to it closed. It means no user sessions refers it. Since the global temporary table is created in the tempdb, whenever we… Read More »

How to change the database collation

By | January 2, 2012

To change the collation of an database following commands can be used: ALTER DATABASE [database name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE ALTER DATABASE  [database name]  COLLATE Newcollation ALTER DATABASE  [database name]  SET MULTI_USER For example , suppose if the name of your database is learningdb and you want to change the collation to the collation SQL_Latin1_General_CP1257_CI_AS, then following commands can be used:- ALTER DATABASE  learningdb  SET SINGLE_USER WITH ROLLBACKIMMEDIATE ALTER DATABASE  learningdb  COLLATE SQL_Latin1_General_CP1257_CI_AS ALTER DATABASE  learningdb  SET MULTI_USER

How to rename a Table in Sql Server

By | January 2, 2012

To rename a column in a SQL Table following command can be reused: SP_RENAME  ‘old table name’, ‘New table name’ For example, if we want to rename the table from employee to employeemaster, following command can be used. SP_RENAME  ’employee’, ’employeemaster’ This command will rename the table from employee to employeemaster.