Hi, I'm seeking for help to export the autogenerated code by an other way that using the button because SAS crash with error message without processing the query. My job consist in modify very long and complex queries, with many connections. I want to export all the code on unique file to make an easy's search and replace. I would like a proc sql for this use. I've found this code for BCP prompt command line, but it doesn't work on SAS EG and I don't know how and if I can use it. SELECT SQL.definition + CHAR(10) + CHAR(13) + 'GO' AS CodeModule
INTO ##MODULES
FROM sys.objects AS OBJETS
JOIN sys.sql_modules AS SQL ON SQL.object_id = OBJETS.object_id
WHERE OBJETS.type IN ('P', 'V', 'TR', 'FN', 'IF', 'TF')
AND OBJETS.name NOT LIKE 'dt%' AND OBJETS.name NOT LIKE 'sp%'
ORDER BY OBJETS.object_id
DECLARE @szBCP VARCHAR(256);
SET @szBCP = 'bcp "SELECT CodeModule FROM ##MODULES" queryout C:\ModulesSQL.sql -T -c';
EXEC master.dbo.xp_cmdshell @szBCP;
DROP TABLE ##MODULES; Thanks for any help. Have a nice day.
... View more