EXEC sp_Msforeachdb 'if exists(select object_name(SC.object_id) ''Table'',len(ST.name) ''TableLength'',SC.Name ''Column'',len(SC.name) ''ColumnLength'' from [?].sys.columns SC inner join [?].sys.tables ST on SC.OBJECT_ID=ST.OBJECT_ID and ST.type=''U'' where len(SC.name)>30 or len(ST.name)>30) select ''?'' as FoundInDb,object_name(SC.object_id) ''Table'',len(ST.name) ''TableLength'',SC.Name ''Column'',len(SC.name) ''ColumnLength'' from sys.columns SC inner join sys.tables ST on SC.OBJECT_ID=ST.OBJECT_ID and ST.type=''U'' where len(SC.name)>30 or len(ST.name)>30' another script EXEC sp_Msforeachdb 'select object_name(SC.object_id) ,len(ST.name) ,SC.Name … Continue reading sp_Msforeachdb is not realiable, it is not fetching details from few other DBs
Month: September 2015
ON UPDATE CASCADE
Script to try for ON UPDATE CASCADE drop table cust,custbase Create table custbase (id int primary key,nm char(10)) insert into custbase values (1,'a') insert into custbase values(2,'b') insert into custbase values(3,'c') Create table cust (custid int references custbase(id) ON UPDATE CASCADE, custname char(10)) insert into cust values (1,'Manish') insert into cust values (1,'Manish1') insert into … Continue reading ON UPDATE CASCADE