Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #131

Re: Stored Procedure Code Critique Requested

From Gene Wirchenko <genew@ocis.net>
Newsgroups comp.databases.ms-sqlserver, microsoft.public.sqlserver.programming
Subject Re: Stored Procedure Code Critique Requested
Date 2011-04-06 11:43 -0700
Organization A noiseless patient Spider
Message-ID <sqcpp6pio7klsauoodg3cn86om9tp3caah@4ax.com> (permalink)
References <nk1np6tl9rthkh068vji35fpq34p7v21ff@4ax.com> <Xns9EBF62D99BA9FYazorman@127.0.0.1>

Cross-posted to 2 groups.

Show all headers | View raw


On Wed, 6 Apr 2011 07:43:02 +0000 (UTC), Erland Sommarskog
<esquel@sommarskog.se> wrote:

>Gene Wirchenko (genew@ocis.net) writes:
>>      I have finished writing my first involved stored procedure.  It
>> makes strings nice.  It works, but it might be better.
>> 
>>      Have I, for example, missed out on functions that could have made
>> it easier?
>
>Kind of. While you can write this stuff in T-SQL, this is exactly why
>Microsoft added the capability to put code written in .Net in SQL Server.

     I have not gotten into .Net.  One at a time.

     What I am going to put on top of this is an insert/update trigger
to clean up strings.  Can I call .Net code from within a trigger?

>>      I also do not know how SQL Server handles multi-line values.  I
>> am assuming there is a CR (or UniCode equivalent) to delimit lines. In
>> case there could be LFs, I eliminate them in the line flagged
>> "--*****TRY".
> 
>SQL Server does not really care much about lines at all. If you put CR-LF at 
>the end of the string, there's a CR-LF at the end of the string. If string 
>only has LF, that's it. Or only CR. It all depends on where the data comes 
>from. If you load a text file from Unix, there will be only LF. If you 
>run examples from SSMS there will probably be CR-LF, since SSMS in a Windows
>application.

     Well, that could make things interesting in a cross-platform
situation.

     SSMS does not display the multi-line values as such.  There is
space between the lines as in:
          LINE ONE line two

>I do not have the time to look at the code as such for now.

Sincerely,

Gene Wirchenko

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Stored Procedure Code Critique Requested Gene Wirchenko <genew@ocis.net> - 2011-04-05 14:26 -0700
  Re: Stored Procedure Code Critique Requested Erland Sommarskog <esquel@sommarskog.se> - 2011-04-06 07:43 +0000
    Re: Stored Procedure Code Critique Requested Gene Wirchenko <genew@ocis.net> - 2011-04-06 11:43 -0700
      Re: Stored Procedure Code Critique Requested Erland Sommarskog <esquel@sommarskog.se> - 2011-04-06 23:58 +0200
  Re: Stored Procedure Code Critique Requested Henk van den Berg <hvandenberg@xs4all.nl> - 2011-04-06 21:15 +0200
    Re: Stored Procedure Code Critique Requested Gene Wirchenko <genew@ocis.net> - 2011-04-06 14:59 -0700
      Re: Stored Procedure Code Critique Requested Erland Sommarskog <esquel@sommarskog.se> - 2011-04-07 00:05 +0200
  Re: Stored Procedure Code Critique Requested Philipp Post <post.philipp@googlemail.com> - 2011-04-12 06:14 -0700

csiph-web