SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Scripts with tag Dynamic SQL Rss

Search for any content tagged dynamic sql

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Add a script

   Items 1 to 17 of 17   

Flexible Index reorganize and rebuild

A script which finds most accessed and defragmented indexes  Read more...
By Ugur Yorulmaz 2018/05/02 | Source: SQLServerCentral.com | Category: reindex
Rating: |  Discuss |   Briefcase | 346 reads

Flexible Statistics Update

Update the statistics starting from most accessed and modified ones, with a time limit. Procedure will exit when @MaxExecutionTime parameter is greater than the current execution time.  Read more...
By Ugur Yorulmaz 2018/04/19 | Source: SQLServerCentral.com | Category: update statistics
Rating: |  Discuss |   Briefcase | 264 reads

Alter all/specific columns by double dynamic SQL

The script uses dynamic SQL twice first to get the detail about the database structure and create ddl out of it second to execute each DDL created  Read more...
By Ashish Shevale 2015/11/03 | Source: SQLServerCentral.com | Category: alter
Rating: |  Discuss |   Briefcase | 916 reads

Dynamic Table Name on Select Into

Based upon todays date as suffix and chosen string as prefix, select data from predefined table into dynamically named new table. Script is properly error handled with most common errors  Read more...
By Jo Dacey 2016/07/27 | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 2,235 reads

Test Your Linked Server Connections

Test your linked server connections and display the results.  Read more...
By Paul Andrew 2016/05/17 | Source: SQLServerCentral.com | Category: dynamic sql
Rating: |  Discuss |   Briefcase | 2,340 reads

Hassle free parameters in dynamic SQL

An alternative solution to passing parameters to sp_executesql. 
Rating: |  Discuss |   Briefcase | 4,027 reads

Right or Wrong, Dynamic SQL AND a Cursor

I'm no big fan of dynamic SQL or cursors, however there are times where they do the job.   Read more...
By Kurt Zimmerman 2013/11/08 | Category: transaction log
Rating: |  Discuss |   Briefcase | 1,815 reads

Create a Comma Delimited CSV File from Any Table/View with Debugging

Dynamically build a comma delimited CSV file using the BCP utility from any table or view in your database with a useful code debugging parameter.  Read more...
By Paul Andrew 2015/05/04 | Source: SQLServerCentral.com | Category: dynamic sql
Rating: |  Discuss |   Briefcase | 5,588 reads

Dynamically Drop a User From Your SQL Instance

Dynamically drop a user from each database on an SQL instance by their server login SID, then remove there server login as well. Plus some helpful printable information when ran.  Read more...
By Paul Andrew 2013/08/09 | Source: SQLServerCentral.com | Category: dynamic sql
Rating: (not yet rated) |  Discuss |   Briefcase | 737 reads

Finding Objects on Your SQL Instance

Find objects in any database on your SQL instance.  Read more...
By Paul Andrew 2013/07/30 | Source: SQLServerCentral.com | Category: dynamic sql
Rating: |  Discuss |   Briefcase | 1,498 reads

Check Candidate Columns for NOT NULL Constraints

This script reports table columns that allow NULL values but that currently have no NULL values, making them candidates for adding a NOT NULL constraint.  Read more...
By Charles Jacobus 2013/01/23 | Source: SQLServerCentral.com | Category: data integrity
Rating: |  Discuss |   Briefcase | 690 reads

Finding Dynamic SQL's Dependencies

The script finds dependencies of Dynamic SQL based on a table containing T-SQL Queries, DB's and Linked Servers in which it can be executed.  Read more...
By Arthur Gimpel 2012/10/15 | Source: SQLServerCentral.com | Category: dynamic sql
Rating: |  Discuss |   Briefcase | 996 reads

Script Table or View structure

This code will let you script a Table or Views structure for source control.   Read more...
By Pratap Prabhu 2010/02/02 | Source: SQLServerCentral.com | Category: scripting
Rating: |  Discuss |   Briefcase | 2,159 reads

Loop Through every table in a DB

This Script has been build to list all the tables in a database without using a cursor.   Read more...
By Chris Morton 2009/01/20 | Source: SQLServerCentral.com | Category: metadata
Rating: |  Discuss |   Briefcase | 2,039 reads

AUTOGENERATE Stored procedures example

This is related to my other autogenerate code. this is just an example of how to use it.   Read more...
By Chris Morton 2008/11/21 | Source: SQLServerCentral.com | Category: autogenerate
Rating: |  Discuss |   Briefcase | 706 reads

search every database on server from a single sp

i have recently had the need to search the every database on the server for a particular string. i came up with this... it has lots of room for improvement but it works  Read more...
By Chris Morton 2008/12/19 | Source: SQLServerCentral.com | Category: search
Rating: |  Discuss |   Briefcase | 960 reads

Demonstration on how to pivot data using temp tables

This script was designed to 'pivot' data that couldnt easily be pivoted in any other way. i used temporary tables to eventually achieve the result i was looking for :)  Read more...
By Chris Morton 2008/10/10 | Source: SQLServerCentral.com | Category: dynamic sql
Rating: |  Discuss |   Briefcase | 961 reads
   Items 1 to 17 of 17