Attack of the stord proc
-
I have this project which is so nasty I don't even want to touch it but as a jock on my professional life I inherited it from a master developers. Application is so pathatically written it makes my mind go crazy whenever there is a fix required. So here is one example of hundreds of stord proc it uses or not uses ( some stord proc are just there for fun :mad:).
CREATE PROCEDURE [dbo].[uspInsertUpdateDeleteFltcode]
@fltCode varchar(8),@fltDesc Varchar(20),@fltGrp varchar(8),@casterRelated bit,
@fltType varchar(2),@flag char(1),@shortDesc Varchar(8),@rptOrd Numeric(9,0)
AS
declare @Operation char(1)BEGIN
SET NOCOUNT ON;
SET @operation=@flag
IF @operation='I'
BEGIN
INSERT INTO FltCode (Flt_Code,Flt_Desc,Flt_Grp,Caster_Related,Flt_Type,Sh_Desc,Rpt_Ord)
VALUES(@fltCode,@fltDesc,@fltGrp,@casterRelated,@fltType,@shortDesc,@rptOrd)
END
IF @operation='U'
BEGIN
....
...
..Some of them call some other stord procs internally. Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why ..:mad:
Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
virang_21 wrote:
jock on my professional
So you think you're some jock[^]. I believe it's more like a joke. ;P
virang_21 wrote:
pathatically
Your spelling is quite pathetic. :-D
virang_21 wrote:
other stord procs internally
So how does a town in Norway[^] figure into all this? :laugh:
virang_21 wrote:
have one strod
An what's this bit with that Russian civil war hero[^]?
virang_21 wrote:
Hmmm,makes me think of cheese. I wonder why? :rolleyes: I'm trying to figure out real hard what really belongs into the hall of shame here. :doh: Cheers!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
-
I have this project which is so nasty I don't even want to touch it but as a jock on my professional life I inherited it from a master developers. Application is so pathatically written it makes my mind go crazy whenever there is a fix required. So here is one example of hundreds of stord proc it uses or not uses ( some stord proc are just there for fun :mad:).
CREATE PROCEDURE [dbo].[uspInsertUpdateDeleteFltcode]
@fltCode varchar(8),@fltDesc Varchar(20),@fltGrp varchar(8),@casterRelated bit,
@fltType varchar(2),@flag char(1),@shortDesc Varchar(8),@rptOrd Numeric(9,0)
AS
declare @Operation char(1)BEGIN
SET NOCOUNT ON;
SET @operation=@flag
IF @operation='I'
BEGIN
INSERT INTO FltCode (Flt_Code,Flt_Desc,Flt_Grp,Caster_Related,Flt_Type,Sh_Desc,Rpt_Ord)
VALUES(@fltCode,@fltDesc,@fltGrp,@casterRelated,@fltType,@shortDesc,@rptOrd)
END
IF @operation='U'
BEGIN
....
...
..Some of them call some other stord procs internally. Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why ..:mad:
Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
virang_21 wrote:
Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why .
For fun, I do not see any other 'advantages'. Nice prefixes - must have been written by a VB6-programmer :)
Bastard Programmer from Hell :suss:
-
virang_21 wrote:
jock on my professional
So you think you're some jock[^]. I believe it's more like a joke. ;P
virang_21 wrote:
pathatically
Your spelling is quite pathetic. :-D
virang_21 wrote:
other stord procs internally
So how does a town in Norway[^] figure into all this? :laugh:
virang_21 wrote:
have one strod
An what's this bit with that Russian civil war hero[^]?
virang_21 wrote:
Hmmm,makes me think of cheese. I wonder why? :rolleyes: I'm trying to figure out real hard what really belongs into the hall of shame here. :doh: Cheers!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
yea mate ... after long debug spelling doesn't matter much.. and English ( Engrish ) is not my first language.. I still swear in my mother tongue when I am frustrated...
Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
-
virang_21 wrote:
Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why .
For fun, I do not see any other 'advantages'. Nice prefixes - must have been written by a VB6-programmer :)
Bastard Programmer from Hell :suss:
-
virang_21 wrote:
jock on my professional
So you think you're some jock[^]. I believe it's more like a joke. ;P
virang_21 wrote:
pathatically
Your spelling is quite pathetic. :-D
virang_21 wrote:
other stord procs internally
So how does a town in Norway[^] figure into all this? :laugh:
virang_21 wrote:
have one strod
An what's this bit with that Russian civil war hero[^]?
virang_21 wrote:
Hmmm,makes me think of cheese. I wonder why? :rolleyes: I'm trying to figure out real hard what really belongs into the hall of shame here. :doh: Cheers!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
This post made me laugh. It's not his native language neither mine for that matter. No shame there, the guy is frustrated.
-
Eddy Vluggen wrote:
must have been written by a VB6-programmer
This joke is less and less funny when you know, work with, and refactor code by vb6 programmers :doh:
If it moves, compile it
loctrice wrote:
This joke is less and less funny when you know, work with, and refactor code by vb6 programmers :doh:
It's not a joke, it's sarcasm. Those prefixes are heavily in use by both Access (VBA) and VB6 developers. You won't see these kind of examples in a book on Sql. Most "experienced" programmers that I worked with are multi-lingual and rarely label themselves using a certain language. ..and yes, I too, worked a lot with VB6. The Professional edition! :rolleyes:
Bastard Programmer from Hell :suss:
-
virang_21 wrote:
Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why .
For fun, I do not see any other 'advantages'. Nice prefixes - must have been written by a VB6-programmer :)
Bastard Programmer from Hell :suss:
Type prefixing is far more common in C++ than VB. http://en.wikipedia.org/wiki/Hungarian_notation[^]
-
I have this project which is so nasty I don't even want to touch it but as a jock on my professional life I inherited it from a master developers. Application is so pathatically written it makes my mind go crazy whenever there is a fix required. So here is one example of hundreds of stord proc it uses or not uses ( some stord proc are just there for fun :mad:).
CREATE PROCEDURE [dbo].[uspInsertUpdateDeleteFltcode]
@fltCode varchar(8),@fltDesc Varchar(20),@fltGrp varchar(8),@casterRelated bit,
@fltType varchar(2),@flag char(1),@shortDesc Varchar(8),@rptOrd Numeric(9,0)
AS
declare @Operation char(1)BEGIN
SET NOCOUNT ON;
SET @operation=@flag
IF @operation='I'
BEGIN
INSERT INTO FltCode (Flt_Code,Flt_Desc,Flt_Grp,Caster_Related,Flt_Type,Sh_Desc,Rpt_Ord)
VALUES(@fltCode,@fltDesc,@fltGrp,@casterRelated,@fltType,@shortDesc,@rptOrd)
END
IF @operation='U'
BEGIN
....
...
..Some of them call some other stord procs internally. Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why ..:mad:
Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
Again I am playing devil's advocate here. I am not suggesting that you should write this code. However Sometime the DBA through SQL user access rights settings won't let program access the database through SELECT/INSERT/UPDATE statements but allow execution of stored procedures. In those scenario you must use STORED procedures to do anything.
-
Type prefixing is far more common in C++ than VB. http://en.wikipedia.org/wiki/Hungarian_notation[^]
Pascal Ganaye wrote:
Type prefixing is far more common in C++ than VB.
Granted; and Apps Hungarian is still in use, with a good reason. Systems Hungarian has been abandoned, also with a good reason. It's not a problem to have used it, but it IS a problem if you still see a modern-day use. Especially since the argument is over ten years old. ..and ffs, why in Sql? Is it really that complex code? No, it simply someone religiously following his "coding standard".
Bastard Programmer from Hell :suss:
-
Again I am playing devil's advocate here. I am not suggesting that you should write this code. However Sometime the DBA through SQL user access rights settings won't let program access the database through SELECT/INSERT/UPDATE statements but allow execution of stored procedures. In those scenario you must use STORED procedures to do anything.
I don't mind use of stored proc.. It is terrible when INSERT/UPDATE/DELETE done in the same stored proc and code is calling the same stored proc with only way to find what operation it is doing is via flag is a big fat FAIL !!!
Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.
-
Pascal Ganaye wrote:
Type prefixing is far more common in C++ than VB.
Granted; and Apps Hungarian is still in use, with a good reason. Systems Hungarian has been abandoned, also with a good reason. It's not a problem to have used it, but it IS a problem if you still see a modern-day use. Especially since the argument is over ten years old. ..and ffs, why in Sql? Is it really that complex code? No, it simply someone religiously following his "coding standard".
Bastard Programmer from Hell :suss:
Sometimes because "Our Dear Leader" dictated that all stored procs shall be prefixed with
sp_
:wtf: at least I could convince him that we should use
usp_
, with difficulty... Sys Hungarian is also common throughout the system, such that
Dim iVariable As String
also happens to be a common sight :sigh:
-
Sometimes because "Our Dear Leader" dictated that all stored procs shall be prefixed with
sp_
:wtf: at least I could convince him that we should use
usp_
, with difficulty... Sys Hungarian is also common throughout the system, such that
Dim iVariable As String
also happens to be a common sight :sigh: