Gerrit Mantel
Programs SQL_STORED_PROCEDURE - prc_save_text_to_file

Main program

Nameprc_save_text_to_file
Type_descSQL_STORED_PROCEDURE
CommentSQLServer Stored Procedure

PURPOSE
Write text variable to ansi file.

OLE Automation Procedures has to be enabled.
Existing files will be overwritten.
If path does not exist, no error is raised. Check path before with function fun_FolderExist.
If file could not be created, no error is raised. Check file afterwards with function fun_FileExist.
Character set Windows-1252 is used, 1 byte per character.
Character set Windows-1252 includes ascii extended characters dec 128-159, except dec 129, 141, 143, 144 and 157.
Character set iso-8859-1 does not handle ascii extended characters dec 128-159 in a proper way, so this character set is unusable here.

Parameters
1 @text VARCHAR(MAX) = (nonbinary) text
2 @filename VARCHAR(265) = filespec

HISTORY
2017-01-25 - Created procedure
2017-01-31 - iso-8859-1 (Latin-1) character set is used
2025-06-06 - Windows-1252 character set is used

TAGS
<program>
<description>Write text variable to ansi file</description>
<generic>1</generic>
<author>Gerrit Mantel</author>
<created>2017-01-25</created>
<lastmodified>2025-06-06</lastmodified>
</program>
DescriptionWrite text variable to ansi file
Minversion
Generic1
AuthorGerrit Mantel
Created2017-01-25 00:00:00
Lastmodified2025-06-06 00:00:00
Xp_cmdshell0
Ole_automation1
Subprogram_cnt0
Sourcecode