Creating Local Temp Table [with #]: SELECT TOP(10) ID INTO #TempTable FROM MyTable Craeting Global Temp Table [with ##]: SELECT TOP(10) ID INTO ##TempTable FROM MyTable Reaching Local Temp Table with Query: SELECT name FROM tempdb..sysobjects WHERE name LIKE ‘#TempTable%’
Tag: local
How to solve “A cursor with the name already exists” problem?
If you get this error then it means you are using global cursor that will be defined each time you are calling this procedure and give you the same error. Define a local cursor. Just put the keyword LOCAL after CURSOR: DECLARE MyCursor CURSOR LOCAL FOR … Reference