Blog About Me Posts By Tags Subscribe Elastic Search My Sessions Terraform

Pavan Kumar Aryasomayajulu


Some Useful SQL Scripts Which I Came Across
  1. List Of all Tables and their columns along with datatypes

    SELECT	o.Name as TableName,c.Name as ColumnName,t.name as DataType,t.length as [DataLength]
     FROM sysobjects o JOIN syscolumns c ON o.id = c.id JOIN systypes t
     ON c.xtype = t.xtype
     WHERE o.xtype = 'u'
     ORDER By o.name
    


  1. Search for a string accross all procedures
SELECT name
FROM   sys.procedures
WHERE  Object_definition(object_id) LIKE '%EmployeeBenefits%'



Thanks,
Pavan Kumar Aryasomayajulu