After generating all CRUD procs with several different naming prefixes, my database was looking messy. So I knew what I wanted to produce but I needed to get rid of all these other procs. So how to quickly drop all the procs. Wayne said he had a codesmith template for it but I couldn't wait. I google'd and found another person that had the same problem after a heavy CodeSmith NetTiers session. His method was not too different from my post from yesterday. I did my final gen of procs via NetTiers but instead of going into the database, sent them to a file. I opened the file to find the following code which should have been both obvious in that NetTiers would need it and where I should look for it:
@procedureName SYSNAMEBEGIN
DECLARE
DECLARE
c CURSOR FORSELECT
name FROM sysobjects WHERE type = 'P' AND objectproperty(id, 'IsMSShipped') = 0AND
name LIKE 'NetTiers_%' AND name NOT LIKE 'WW_{0}_%'OPEN
cFETCH
NEXT FROM c INTO @procedureNameWHILE
@@FETCH_STATUS = 0BEGIN
EXEC
('DROP PROC ' + @procedureName)FETCH
NEXT FROM c INTO @procedureNameEND
CLOSE
cDEALLOCATE
cEND
No comments:
Post a Comment