Wednesday, 3 July 2013

How to find Database,Store Procedures,Views,Triggers from Sql Server…


select @@SERVERNAME as 'ServerName',@@VERSION as 'Version'

ServerName -KUSH-PC\KUSH
Version-Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (Intel X86)   Apr  2 2010 15:53:02   Copyright (c) Microsoft Corporation  Express Edition with Advanced Services on Windows NT 6.1 <X64> (Build 7600: ) (WOW64)

//Select database from Sql Server
select * from sys.databases
select * from sys.databases where name='jobportal'
select * from sys.databases where name like 'l%'

//Select tables from database JobPortal

use JobPortal
select * from sys.tables
select * FROM sys.tables where name='t1'
select * from sys.tables where name like 'Company%'

//Select procedures from database JobPortal

select * from sys.procedures
select * from sys.procedures where name='fund'
select * from sys.procedures where name like '%n%'

//Select views from database JobPortal

select * from sys.views
select * from sys.views where name='myview'
select * from sys.views where name like '%li'

//Select triggers from database JobPortal

select * from sys.triggers
select * from sys.triggers where name='kush'
select * from sys.triggers where name like '%u%'


//Select sys.columns, sys.all_views, sys.views, sys.assemblies from database JobPortal

select * from sys.columns
select * from sys.all_views
select * from sys.views
select * from sys.assemblies

0 comments:

Post a Comment