Wednesday, April 29, 2009

Copy database diagram from one DB to another DB

Copy database diagram from one DB to another DB

insert into newdb.dbo.sysdiagrams select name, principal_id,[version], [definition] from olddb.dbo.sysdiagrams

Tuesday, April 14, 2009

Query to retrieve stored procedures and views for a particular text


select so.id,so.name,so.xtype, sc.text from syscomments sc
inner join sysobjects so on so.id = sc.id
where sc.text like '%select *%'
and so.xtype in('P','V')