Category: Scripts

  • Identify Null Columns and Data Null Columns

    I saw an interesting question in Facebook group. It’s all related to NULL values.. How to identify NULLable columns in a table and column with data as NULL. I thought of searching it in internet and pointing him to the link but I couldn’t get a reliable post to point it to the user so…

  • Generate Users and Roles Script

    Couple of weeks back I wrote a script for generate object level permission in the database. People started requesting me to write a script which should script all the users and roles in a database. I came up with this script which will script roles and users in a database and it will also associate…

  • T-SQL Script to find the names of the StoredProcedure that has used dynamic SQL

    This article has the script that will be useful to find the names of the  Stored procedure that has used dynamic sql within the definition of the Stored procedure . In this post , I am creating a sample database with four stored procedures to show an example on how the script works :

  • Generate Permission script for an object or all object

    In the DBA world it’s necessary to pickup permissions for an object for all objects when he\she deploys the code. During deployment if the code has DROP and CREATE then it’s obvious that what ever permission you have assigned to that object will get lost so as a first step you need to script out…

  • Batch script to deploy multiple SQL files

    I was working on a project where I’m supposed to deploy lots of SQL Server script files (.sql). It’s very tedious job either to manually execute or to write a batch script each time when the deployment moves to another environment. So I decided to write a batch script which should be dynamic in nature…