在数据库'tempdb'中拒绝CREATE TABLE权限

编程入门 行业动态 更新时间:2024-10-19 00:26:57
本文介绍了在数据库'tempdb'中拒绝CREATE TABLE权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我第一次在系统上安装SQL Server Management Studio Express和Visual Studio 2005。现在,我尝试使用以下脚本创建表。但是,如果执行一次,我将遇到类似

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 am facing error like

CREATE TABLE权限在数据库'tempdb'中被拒绝的错误。

CREATE TABLE permission denied in database 'tempdb'.

为什么?有人可以帮我解决这个问题吗?

Why it it? Can anyone help me how to resolve this ?

USE [tempdb] GO SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Employee] ([FirstName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [LastName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY]

感谢 Raju

Thanks Raju

推荐答案

我最初的猜测是您在此服务器上没有CREATE表权限。您可以在下面运行这些查询吗?

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

如果Permission_name列返回0行,则意味着您对该数据库没有CREATE权限。请与您的DBA联系以为db授予db_ddladmin。但是,正如Andomar指出的那样,当使用#预先添加时,临时表将在tempDB中自动创建。

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 #.

更多推荐

在数据库'tempdb'中拒绝CREATE TABLE权限

本文发布于:2023-10-15 03:07:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1493065.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:权限   数据库   tempdb   CREATE   TABLE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!