Showing posts with label Sql. Show all posts
Showing posts with label Sql. Show all posts

Friday, September 13, 2013

Difference between Local Temp Table and Global Temp Table ?

What is the difference between Local Temp Table and Global Temp Table ? Temporary tables are temporary storage structures. You may use temporary tables to store data that you will manipulate before arriving at a final format.    Local Temp Table:  The hash (#) character (prefix with tablename) is used to declare a temporary table  as it is prepended to the table name. A single hash (#) specifies a local temporary table.  Local temporary tables are available to the current connection for the user, so they  disappear when the user disconnects. Within SQL Server, temporary tables are stored  in the Temporary Tables folder of the tempdb database. Syntax for creating Local Temp Table Create table #tempLocalTableName(EmpId int, EmpName varchar(50), EmpAdd varchar(100)) Global Temp Table: Global temporary tables may be created with double hashes (##) (Prefix with table name).  These are available to all users via all connections, and they are deleted only when all  connections are closed. Once created, these tables are used just like permanent tables;  they should be deleted when you are finished with them.  Syntax for creating Temp Table Create table ##tempGlobalTableName(EmpId int, EmpName varchar(50), EmpAdd varchar(100)) If...


Thursday, August 22, 2013

Difference between Stored Procedure and Function In Sql

Hello Friends, Today I am writing this post because of this is very important question in interview  Inside procedure we can use DML (Insert /Update/Delete) statements, But Inside function we can not use DML statements. Procedure can have both input\output parameters,  But Function can have only input parameter. We can use Try-Catch Block in Stored Procedure, But In Function We can not use Try-Catch block. We can not use Stored Procedure in Select statement, But In Function We can use in Select statement. Stored Procedure can return 0 or n values (max 1024), But Function...