Saturday, January 16, 2010


We can't alter Model/Mastr Db Structure: as shown above

Table Variables Exist in TEMPDB

Hi All,
To Prove that Table variable exists in TEMPDB Run
Select * from tempdb.Information_schema.tables where table_name like '%#%'
go
Declare @v Table(ID Int Identity Primary key nonclustered, B Int)
Insert @v Select 1
run above select command ----------Select
HEY HEY Enjoy.....................

Create Temp Permanent tables in TempDB....Something to think

One user reported that he was getting errors--
Create Table Permission denied in database tempdb
so to simulate i created user Sheetal in default database: tempdb
so when executed, this he got error
-------------------------
USE TempDB
Go
Create table A(ID Int) ---ERR

BUT HE CAN Execute

CREATE TABLE #A(ID INT)

i checked that user guest was enabled in TempDB. but then what could be the problem.................

Solution:


In this scenario , where we have to give users access to only TempDB, we have to give him rights to Create Table in TempDB.


Grant Create Table To Public/Sheetal

Now he is able to create temp permanent tables means
Create table A(id int)

--there is syntactically no difference between these A and #A
But in case of A, we can refrence in another database in anoter session.
Select * from tempdb..A

Hope this helps!................................