CREATE TABLE permission denied in database 'tempdb'

后端 未结 6 1115
野的像风
野的像风 2021-02-18 17:45

First time I installed SQL Server Management Studio Express and Visual Studio 2005 on my system. Now I am trying to create table by using below script. But if once I execute I a

6条回答
  •  闹比i
    闹比i (楼主)
    2021-02-18 18:30

    My initial guess is you do not have CREATE table rights on this server. Can you please run these set of queries below?

    
    -- get login first 
    select suser_name() 
    --or 
    SELECT SYSTEM_USER
    
    -- Now get the permissions assigned to you by the server administrator 
    use tempDB 
    GO 
    
    ;with getPermissions as ( SELECT * FROM fn_my_permissions (NULL, 'DATABASE') ) 
    select permission_name from getPermissions 
    where permission_name like 'create%' 
    GO
    
    

    If permission_name column returns 0 rows then it means you do not have CREATE permission on this DB. contact your DBA to grant db_ddladmin for tempDB. However as Andomar noted the temp tables are automatically created in tempDB when pre-appended with #.

提交回复
热议问题