Thanks guys, I'm using MS SQL Server 2000 Enterprise but I'm not connecting with the DBI - but with the MS DMO Library.
I'll try a few of those suggestions, I guess the question is kind of acedemic because I can script the procedures to ANSI - but as they were already stored in source-safe as unicode - i thought that a perl solution that handled unicode would be better (save the hassle of organising for all procedures to be checked in, etc)
On the version of unicode being used: I do not know - books on-line just say International(Unicode) "Select this option if the script uses special international characters that are supported only in the Unicode font."
Here's the PERL code
sub insert_the_string { my $old_file = shift; my $new_file = $old_file . "sql2"; my $line = ''; open(OLD, "< $old_file"); open(NEW, "> $new_file"); my $text .= concatenate_string_to_insert(); # documentation header $text .= "as\n"; my $as_RE = "AS"; # replace the first occurance of 'AS' after the + stored procedure definition select(NEW); # new default for print while (defined($line = <OLD>) ){ # chomp $line; if ($line =~ s/$as_RE/$text/) { chomp $line; $line .= <OLD>; redo unless eof(OLD); } print NEW $line; } close(OLD); close(NEW); rename($old_file, "$old_file.orig"); rename($new_file, $old_file); }
When I say garbage I mean something like the following...
/****** Object: Stored Procedure dbo.a_sp_D_Add Script Date: 02/04 +/2002 17:00:18 ******/ &#2573;&#12032;&#10752;&#10752;&#10752;&#10752;&#10752;&#10752;&#8192; +&#2304;&#3328;&#3328; Marina Motchkina &#2573;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192;&#8192; +&#8192;&#2304;&#12288;&#13312;&#12032;&#12288;&#13056;&#12032;&#12288 +;&#12800;&#3328;&#3328; &#2573;&#2304;&#21248;&#20736;&#19456;&#8192;&#26112;&#28416;&#29184;& +#8192;&#17408;&#30720;&#30720;&#30720;&#8192;&#25344;&#28416;&#27904; +&#28672;&#28416;&#28160;&#25856;&#28160;&#29696;&#29440;&#3328;&#3328 +; ******/ &#2573;&#3328;&#3328; CREATE PROCEDURE a_sp_D_Add &#2573;&#2304;&#16384;&#21504;&#24832;&#25088;&#27648;&#25856;&#19968; +&#24832;&#27904;&#25856;&#8192;&#30208;&#24832;&#29184;&#25344;&#2662 +4;&#24832;&#29184;&#10240;&#13056;&#12288;&#10496;&#3328;&#3328; &#2573;&#3328;&#3328; as &#2573;&#2304;&#25600;&#25856;&#25344;&#27648;&#24832;&#29184;&#25856; +&#8192;&#16384;&#29440;&#29696;&#29184;&#21248;&#20736;&#19456;&#8192 +;&#30208;&#24832;&#29184;&#25344;&#26624;&#24832;&#29184;&#10240;&#13 +312;&#12288;&#12288;&#12288;&#10496;&#3328;&#3328; select @strSQL='SELECT ' + @TableName+'.* '+ ' FROM ' + @TableName + +' WITH (NOLOCK) WHERE '+ @TableName+'.'+@TableName+'Counter =0' &#2573;&#3328;&#3328; &#2573;&#3328;&#3328; &#2573;&#3328;&#3328; GO &#2573;&#21248;&#17664;&#21504;&#8192;&#20736;&#21760;&#20224;&#21504; +&#17664;&#17408;&#24320;&#18688;&#17408;&#17664;&#19968;&#21504;&#186 +88;&#17920;&#18688;&#17664;&#20992;&#8192;&#20224;&#17920;&#17920;&#8 +192;&#3328;&#3328; GO &#2573;&#21248;&#17664;&#21504;&#8192;&#16640;&#19968;&#21248;&#18688; +&#24320;&#19968;&#21760;&#19456;&#19456;&#21248;&#8192;&#20224;&#1996 +8;&#8192;&#3328;&#3328; GO &#2573;&#3328;&#3328;

graff - you're right about posting unicode to the site - it looked nicer than this - but still garbage.
Thanks anyway - I'm off to find out about 'ucs2' & 'utf16' & install the Unicode::String module.

In reply to Re: Problems with Unicode files generated with SQL Server by Cuchulain
in thread Problems with Unicode files generated with SQL Server by Cuchulain

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.