MSSQL: How do you script Stored Procedure creation with code?
问题 I am trying to query for a list of stored procedure definitions using information_schema.routines that exist in one database but not in another. SELECT t1.Routine_Definition FROM [server1].MyDatabase.INFORMATION_SCHEMA.Routines t1 LEFT JOIN [server2].MyDatabase.INFORMATION_SCHEMA.Routines t2 ON t1.Routine_Name = t2.Routine_Name WHERE t2.Routine_Name is null This gives me the query definitions in a single line so when I have a comment like this --Some comment SELECT Column FROM Somewhere The