In the USE [Views] statement, Views is an existing database name. It seems you do not have that database named Views.
USE [DATABASE_NAME];
GO
CREATE TABLE ...
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a table that is in a database and I would like to copy it to the Views table I'm getting an error. Below are the errors
Msg 911, Level 16, State 1, Line 1
Database 'Views' does not exist. Make sure that the name is entered correctly.
Msg 2714, Level 16, State 6, Line 2
There is already an object named 'VW_vision_for_fire' in the database.
Code
USE [Views]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[VW_vision_for_fire]
(
[REM_GIS_ID] nvarchar NULL,
[Location] nvarchar NULL,
[Owner Name] nvarchar NULL,
[Owner Address] nvarchar NULL,
[Owner Address 2] nvarchar NULL,
[Style] nvarchar NULL,
[Model] nvarchar NULL,
[Stories] nvarchar NULL,
[Grade] nvarchar NULL,
[Rooms Desc] nvarchar NULL,
[Bedrooms Desc] nvarchar NULL,
[Ext Wall 1] nvarchar NULL,
[Roof Struct] nvarchar NULL,
[Roof Cover] nvarchar NULL,
[Int Wall 1] nvarchar NULL,
[Heat Type] nvarchar NULL,
[Air Cond Type] nvarchar NULL
) ON [PRIMARY]
GO
In the USE [Views] statement, Views is an existing database name. It seems you do not have that database named Views.
USE [DATABASE_NAME];
GO
CREATE TABLE ...
Hi @Chris Slinko ,
Welcome to the microsoft TSQL Q&A forum!
Guoxiong has already explained the reason for the error. In addition, I want to add that please check again whether the database name you want to use is Views. If it is View, if you enter Views, similar errors will be returned.
The reason for this error is: CREATE TABLE statement will create a new table, if the table already exists before, it will return the above error.In other words, before running
CREATE TABLE [dbo].[VW_vision_for_fire]. . .
Statement, the [dbo].[VW_vision_for_fire] table already exists in your database. It is also possible that you have repeatedly executed
CREATE TABLE [dbo].[VW_vision_for_fire]. . .
To solve this problem, just execute DROP TABLE npub_info before executing CREATE TABLE [dbo].[VW_vision_for_fire]...
If you have any question, please feel free to let me know.
If the response is helpful, please click "Accept Answer" and upvote it.
Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.