简体   繁体   中英

How to create a table value function script in a DACPAC SQL Server project?

I have a DACPAC SQL Server project that I edit in Visual Studio. I then have a SQL script for a table value function. How can I then embed the SQL script into the DACPAC project? I can't find any tutorial on how to make the folder and folder name, and how to set up the SQL file.

Does anyone know?

Creating folders isn't actually a requirement. When you build the project all objects represented in the project file will be added to the resulting DACPAC. Folders are merely a way to organize your files.

Generally speaking, your folder structure within the SQL DB project will look something like this:

Schema1
  Functions
    SomeFunc.sql
    OtherFunc.sql
  Stored Procedures
    SomeProc.sql
    OtherProc.sql
  Tables
    SomeTable.sql
    OtherTable.sql
  Views
    SomeView.sql
    OtherView.sql

Schema2
  Functions
    SomeFunc.sql
    OtherFunc.sql
  Stored Procedures
    SomeProc.sql
    OtherProc.sql
  Tables
    SomeTable.sql
    OtherTable.sql
  Views
    SomeView.sql
    OtherView.sql
. . . etc . . .

NOTE: if you create your function in a SQL Server DB, you can then jump back into Visual Studio and use Tools >> SQL Server >> Schema Compare to import your function into the project. Visual Studio will create the folders for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM