Export All Views to Text Files
问题 There are a number of views in a database on one of our servers. I need to save all the view definitions as text files in the following format: IF OBJECT_ID('<[Schema_Name].[VIEW_NAME]>') IS NOT NULL DROP VIEW <[Schema_Name].[VIEW_NAME]> GO <<View Definition Here>> GO GRANT SELECT ON <[Schema_Name].[VIEW_NAME]> TO [PUBLIC] GO The text file should be named as Schema_Name.VIEW_NAME.txt I don't want to do this manually as this would take up all my time. Any idea if this can be automated? Maybe