Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.news-service.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Gene Wirchenko Newsgroups: comp.databases.ms-sqlserver,microsoft.public.sqlserver.programming Subject: Re: Stored Procedure Code Critique Requested Date: Wed, 06 Apr 2011 11:43:11 -0700 Organization: A noiseless patient Spider Lines: 42 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: mx03.eternal-september.org; posting-host="7Qrvczazr82YckO5XW8Vtw"; logging-data="15181"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19p0g+UlJYkHPBbvI61n5i5oRFBANfnnC0=" X-Newsreader: Forte Agent 4.2/32.1118 Cancel-Lock: sha1:+n+IcYLH5l8oXrOOlkX+sC3/4X0= Xref: x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:131 On Wed, 6 Apr 2011 07:43:02 +0000 (UTC), Erland Sommarskog 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