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

T-SQL Tuesday Live–7 Apr 2020

By

Last week went a little crazy, and I learned something: don’t post a Zoom...

Getting Your dbatools Version–#SQLNewBlogger

By

Another post for me that is simple and hopefully serves as an example for...

SQL Server and VMware Resource Pools

By

Resource pools are used to hierarchically partition available CPU and memory resources, and are...

Read the latest Blogs

Forums

Tools for DISA's SQL Server STIGs

By aborelli1

Is it possible to request a review of a tool I created to automate...

bcp format file and import fixed width text file

By smattiko83

I'm trying to set up a format file using bcp but I'm unsure of...

insert random value from predefined list of possible values

By marchello

Hi all, My need is to insert random value from predefined list of possible...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers

Question of the Day

Linux Support

See possible answers