sql-servervisual-studiovisual-studio-2017sql-server-data-toolssql-server-2016-localdb

Visual Studio SSDT how do i run/execute a table that i created? It is a .sql file but not showing in SQL Server


I have used SSDT back in 2014, but I have forgotten most of it AND it seems a lot different now in with VS 2017 etc..

  1. I see both (localdb)\MSSQLLocalDB and I see (localdb)\ProjectsV13 - based on what I read. I assume I should use MSSQLLOCALDB (I want create a database project and create my schema with SQL Server Object Explorer, then import the database into a VS database project)
  2. I cannot seem to execute the table that I created (I can open up SSMS and create it, but that defeats the purpose of this sort of)
  3. Also I want to then send /run on another database server dacpac/bacpac but seems like so many videos are outdated from 2014 using SQL Server Express etc..

Example of simple table:

CREATE TABLE [dbo].[Tablexddd]
(
    [Id] INT NOT NULL PRIMARY KEY
)

Update

So here is the actual table I was trying to publish

CREATE TABLE [dbo].[Session_Tracker] (
[Id]          INT            NOT NULL,
[SessionId]   INT            IDENTITY (1, 1) NOT NULL,
[TimerStart]  DATETIME       NULL,
[TimerEnd]    DATETIME       NULL,
[SessionNote] NVARCHAR (MAX) NULL,
CONSTRAINT [PK_Tracker_Session] PRIMARY KEY CLUSTERED ([Id] ASC)
);

Solution

  • You can perform a schema compare between the project and the target database. You can find it in Tools > SQL Server > New schema comparison... menu.

    If all you want is to deploy a single table, complete redeployment sounds like an overkill, while schema comparison looks optimal.

    DACPAC is also an option, you can build your database project and the .dacpac file will be created in the /bin/(BuildConfiguration) folder, usually it's /bin/Debug. I don't think much has changed in this way of deployment.