SQL Server- Output clause

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 […]

Continue Reading

SQL Server – Global temporary tables

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 […]

Continue Reading

How to change the database collation

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

Continue Reading