日期:2014-05-18  浏览次数:20507 次

为什么创建表单时老是出现已存在 但是是第一次创建啊
消息 2714,级别 16,状态 6,第 1 行
数据库中已存在名为 'Studentes' 的对象。


------解决方案--------------------
在创建表的时候先检测一下是否该名称的表存在,若存在则删除,否则直接建表。
if exists(select name from sysobjects where name='Studentes' )
drop Studentes
go
create table Studentes
(
studentId int IDENTITY(1,1) primary key,
studentName varchar(10),
age int 
)
希望对你有帮助!
------解决方案--------------------
存在这个对象,但是这个对象不一定是表。
------解决方案--------------------
正如楼上所说,这个对象不一定是表,可能是存储过程,函数,或者触发器等
可以以下语句查一下
SQL code
select * from sys.objects where name='Studentes'