PDA

View Full Version : Incestious SQL....



Peager
18-Feb-2005, 03:27 PM
Below is a script that generates an SQL script to change the length of a
field wherever it exists in the database. It looks to be a really slick
trick that others may want to play with. I needed to lengthen our audit
fields to contain longer view names.... It's setup for SQL but I believe
the concept will work for any SQL environment.

SELECT 'Alter Table ' +
RTrim(F."Xf$Name") +
' (Modify Column CREATED_VIEW CHAR(40),
Modify Column EDITED_VIEW CHAR(40))#'
FROM ("X$File" F Inner Join "X$Field" Fld On Fld."Xe$File" = F."Xf$Id")
WHERE Fld."Xe$Name"='Created_View'
AND Fld."Xe$Size" < 40
ORDER BY F."Xf$Name",Fld."Xe$Name"#



--
Paul E. Richmond
IS Project Leader
L.D. McFarland Co.
(253) 572-3033