Generate code
Quickstart: Generate code In this quickstart, you learn how GitHub Copilot accelerates SQL and object-relational mapping (ORM) development by generating context-aware code directly within Visual Stu
Quickstart: Generate code
In this quickstart, you learn how GitHub Copilot accelerates SQL and object-relational mapping
(ORM) development by generating context-aware code directly within Visual Studio Code.
GitHub Copilot helps you scaffold tables, evolve schemas, and reduce repetitive scripting.
Whether you’re using Transact-SQL, or working with object-relational mapping (ORM)
frameworks like Entity Framework, Sequelize, Prisma, or SQLAlchemy, GitHub Copilot helps you
focus on building application logic.
Make sure you’re connected to a database and have an active editor window open with the
MSSQL extension. When you connect, the
chat participant understands the context of
your database environment and can give accurate, context-aware suggestions. If you don’t
connect to a database, the chat participant doesn’t have the schema or data context to provide
meaningful responses.
The following examples use the
sample database, which you can
download from the
Microsoft SQL Server Samples and Community Projects
home page.
For best results, adjust table and schema names to match your own environment.
Make sure the chat includes the
prefix. For example, type
followed by your
question or prompt. This prefix ensures that the chat participant understands you’re asking for
SQL-related assistance.
Use GitHub Copilot to generate SQL and ORM-compatible code that reflects your connected
database’s structure and follows best practices. From defining tables and relationships to
scripting views, building migration files, or scaffolding data access layers and APIs, GitHub
Copilot helps you move faster and with greater confidence.
Here are common use cases and examples of what you can ask through the chat participant:
GitHub Copilot can help you generate SQL code for several development scenarios, from
scripting, creating, and modifying tables to writing stored procedures and views. These
examples illustrate how you can use GitHub Copilot to automate repetitive SQL scripting and
follow best practices for T-SQL development.
@mssql
AdventureWorksLT2022
@mssql
@mssql