Showing posts with label sqlserver. Show all posts
Showing posts with label sqlserver. Show all posts

Sunday, June 14, 2015

Find table, view, stored procedure, etc list in database SQL Server

Use this query to find table list in database SQL Server:

SELECT * FROM information_schema.tables

Complete query for finding table, view, storedprocedure, key, etc

SELECT sobjects.name

FROM sysobjects sobjects

WHERE sobjects.xtype = 'U'


Object type:
C: Check constraint
D: Default constraint
F: Foreign Key constraint
L: Log
P: Stored procedure
PK: Primary Key constraint
RF: Replication Filter stored procedure
S: System table
TR: Trigger
U: User table
UQ: Unique constraint
V: View
X: Extended stored procedure

Best Wishes,

LadyinProgramming



Find column in table by name sql server

Use this query to find column in table by column name in SQL Server:

SELECT c.name AS ColName, t.name AS TableName
FROM sys.columns c
    JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%YourKeyword%'


Best Wishes,

LadyinProgramming

Find stored procedure containing text in sql server

Use this query to find stored procedure containing text in sql server:

SELECT name
FROM   sys.procedures
WHERE  Object_definition(object_id) LIKE '%YourKeyword%'


Best Wishes,

LadyinProgramming