Dynamic SQL

Execute Dynamic SQL commands in SQL Server

  • Article

In some applications having hard coded SQL statements is not appealing, because of the dynamic nature of the queries being issued against the database server. Because of this sometimes there is a need to dynamically create a SQL statement on the fly and then run that command. This can be done quite simply from the application perspective where the statement is built on the fly whether you are using ASP.NET, ColdFusion or any other programming language. But how do you do this from within a SQL Server stored procedure?

2016-05-03

5,701 reads

Blogs

Azure SQL Managed Instance Versions

By

Just a really quick FYI for the readers. If you are using Managed Instances...

A summary of new features in Azure SQL Database

By

It has been some time since I last wrote about Azure SQL Database. Although...

Daily Coping 23 Jun 2021

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Read the latest Blogs

Forums

about the concern about sp_updatestats

By 892717952

Do I still need to run sp_updatestats  if I execute DBCC DBREINDEX(tablename) for tables...

SQL Server 2019 Distributed Availability Groups

By DK

Hello.  I am looking into setting up a Distributed Availability Group between 2 availability...

Server Roles and Permissions

By Atat Rowcount

Hi guys Setting up a new SQL Server on Azure (Managed Instance).  I have...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers