Saturday, November 18, 2006

How to work at same time with T-SQL Stored Procedure and Coding standards

I was having real bad time by modifying the T-SQL procedures according to our coding standards. It's because the editor which comes with SQL Sever 2005, doesn't provide auto-indent or auto-format functionality.

Another thing! Command to read stored i.e. SP_HelpText doen't read TABs (or there is a problem in my way of copy-pasting). So all my hardwork with go in vain if I don't take care about that. And the editor allows you to use TABs freely and, without mistake, it puts the tab character instead of bunch of spaces. 'Untabbify' functionality is there in the editor but I don't know why the hell it's not working everytime.

So currently, as I have to bear with this hell, I am following a new approach.

That is, first develop procedure in SQL server editor (fast for development) and then go to scintilla and format the shit. I got many problem with scintilla but all were solved when I downloaded MSI from http://gisdeveloper.tripod.com/scite.html This MSI comes with some good extensions and customized preferences. This preference are set exactly the same which I wanted (i.e. No tabs, tab size 4, font preferences etc).

So life is not so good because there is not directly 'auto-format' function, but the above approach is working until Microsoft really does something :)

3 comments:

Yogee said...

Oh well! A little correction. sp_helptext command reads stored procedure text correctly but when I copy-paste the content then somewhere TABs are eaten.

Anonymous said...

Apprecite your effort... but most of the things are straight from the book Inside SQL 2000.... if I am not wrong... !!

~
:)

Yogee said...

It will surprise me if a book on "SQL 2000" contains features of MS SQL Server 2005. Only a great oracle write that book :D