Saturday, November 6, 2010

I am not sure if this holds still good. I will do some research before I publish this post. I haven't thought that I will be using SQL server again in my life but things come around in a consulting job and you will use all the databases. So hang on this post will help you to customize your sql server management studio and make your life easy.



create procedure sp_HelpTables
(
@paramTables varchar(30)
)
as
Begin
declare @strSQL varchar(500)
select @strSQL = 'select * from information_schema.Tables where table_name like ''%' + @paramTables + '%'''

Exec(@strSQL)

End
go


create procedure sp_HelpColumns
(
@paramColumn varchar(30)
)
as
Begin
declare @strSQL varchar(500)
select @strSQL = 'select * from information_schema.Columns where column_name like ''%' + @paramColumn + '%'''

Exec(@strSQL)

End
go


create procedure sp_HelpSelect
(
@paramTable varchar(50)
)
as
Begin
declare @strSQL varchar(500)
select @strSQL = 'select * from ' + @paramTable
Exec(@strSQL)
End

go

No comments:

Post a Comment