SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 User-Defined string Functions Transact-SQL
 New Topic  Reply to Topic
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 5

robvolk
Most Valuable Yak

USA
15688 Posts

Posted - 06/17/2005 :  18:51:12  Show Profile  Visit robvolk's Homepage  Reply with Quote
Igor-

Regarding the article:

Articles are reserved for: detailed presentations on a particular database problem (and solution); tutorials; interesting news items about databases and/or SQL Server; reviews of database-related topics such as training, seminars or conferences, and possibly product reviews. Your function library does not meet these criteria, and I don't think an article would best serve them either.

Additionally, articles are posted here to serve the SQL Team community, not to trumpet the accomplishments or cleverness of one person. It would be fair to say that, so far, your contribution to SQL Team has consisted entirely of the latter. Your functions may indeed be valuable to many people, (you've certainly put a great deal of effort into telling us this) but that statement repeated over and over again doesn't really serve the community nor constitute an article.

You have a library of functions, therefore I think they are perfectly suited to be posted in the SQL Team Script Library forum. By the way, "posting" does not mean putting a link to your web site (again) but the actual code of the functions. This simple act would go a long way towards convincing us that you truly want to be a part of SQL Team and genuinely want to help everyone here.
Go to Top of Page

Igor2004
More clever than you

Canada
78 Posts

Posted - 06/17/2005 :  19:21:46  Show Profile  Visit Igor2004's Homepage  Reply with Quote
Unessentially article, in script section ?

"It would be fair to say that, so far, your contribution to SQL Team has consisted entirely of the latter. "
I agree, but it is necessary to begin with something.

"By the way, "posting" does not mean putting a link to your web site (again) but the actual code of the functions. This simple act would go a long way towards convincing us that you truly want to be a part of SQL Team and genuinely want to help everyone here."
I can place here more than 700 lines?

Igor


I'm good programmer,
no, no, no I'm average programmer
Go to Top of Page

robvolk
Most Valuable Yak

USA
15688 Posts

Posted - 06/17/2005 :  19:26:21  Show Profile  Visit robvolk's Homepage  Reply with Quote
Even though you could post more than 700 lines, each function should be posted as its own separate topic.
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

Australia
4970 Posts

Posted - 06/17/2005 :  22:01:32  Show Profile  Visit Merkin's Homepage  Reply with Quote
When someone says the average developer, he / she is the average developer.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

Australia
4970 Posts

Posted - 06/17/2005 :  22:01:43  Show Profile  Visit Merkin's Homepage  Reply with Quote
When someone says the average developer, he / she is the average developer.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

Australia
4970 Posts

Posted - 06/17/2005 :  22:02:26  Show Profile  Visit Merkin's Homepage  Reply with Quote
Igor

Yes, you may repost my rhyme on your website. You have my permission.


Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

Igor2004
More clever than you

Canada
78 Posts

Posted - 06/17/2005 :  23:25:08  Show Profile  Visit Igor2004's Homepage  Reply with Quote
Dear, Damian

One's heartfelt thanks for permission.

Please look below http://www.universalthread.com/wconnect/wc.dll?LevelExtreme~2,54,33,27115

Warmest regards,
Igor
Go to Top of Page

Seventhnight
Flowing Fount of Yak Knowledge

USA
2878 Posts

Posted - 06/18/2005 :  00:08:25  Show Profile  Visit Seventhnight's Homepage  Reply with Quote
Igor - You attempted to give me a practical purpose for your occurances(with overlaps), but you basically just gave me another one of your functions (some At function). That function also doesn't imply a practical application, so it bears no support for the occurs function.

I was looking for a real world situation where the particular functionality would be required to manage/massage some data. I would like to hazard this theory: If a function to count the number of occurances of 1 string in another, and include the overlaps, is required, then the database design is highly questionable.

nighty-night!

quote:
Originally posted by Merkin

When someone says the average developer, he / she is the average developer.

Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson



Hey! I thought we were on the same team here... (i said he was an average developer)

Corey

Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now."
Go to Top of Page

Igor2004
More clever than you

Canada
78 Posts

Posted - 06/18/2005 :  01:02:37  Show Profile  Visit Igor2004's Homepage  Reply with Quote
'That function also doesn't imply a practical application, so it bears no support for the occurs function.'

From: Dave
Date: Sunday, April 24, 2005 7:43 PM
Newsgroup: microsoft.public.sqlserver.programming
Subject: String Function Issue
How can I use the T-SQL string functions to find the _third_ occourance of a
character.

For example, I have an email field and it has data that looks like this:

http://www.domain.com/abunchoftrash/apagename.aspx

I want to find the position of the third occurence of '/' so I can use its
position to extract just the main domain name, truncating all the trailing
garbage.

Does anyone have any ideas on how to do this?
____________________________________________________________________________________

It was a pity that you there not, but also without you Dave has received many valuable advice !
for instance
____________________________________________________________________________________
From: Steve Kass
Date: Sunday, April 24, 2005 7:38 PM
Newsgroup: microsoft.public.sqlserver.programming
Subject: Re: String Function Issue

Dave,

Here's an example that should help you out:

declare @t table (
s nvarchar(1000)
)

insert into @t values ('http://www.domain.com/abunchoftrash/apagename.aspx')
insert into @t values
('http://x.y.domain.com/abunc/y/x/ftrash/apagename.aspx')

select
substring(s,a,charindex('/',s,a)-a) as theDomain
from (
select
s,
charindex('//',s) + 2 as a
from @t
) T


Steve Kass
Drew University

____________________________________________________________________________________
From: CBretana
Date: Sunday, April 24, 2005 8:58 PM
Newsgroup: microsoft.public.sqlserver.programming
Subject: Re: String Function Issue

Declare @V VarChar(89)
Set @V = 'http://www.domain.com/abunchoftrash/apagename.aspx'

Select Substring(@V, CharIndex('//', @V) + 2, CharIndex('/',
Substring(@V, CharIndex('//', @V) + 2, Len(@V)))-1)
____________________________________________________________________________________
And here is how average programmers act
select dbo.AT('/','http://www.domain.com/abunchoftrash/apag.aspx',3

If function AT is not necessary, what for then function charindex ?
In what between them a basic difference ?

I would like to hazard this theory: If a function to returns the starting position of the specified expression in a character string, is required, then the database design is highly questionable.

"Hey! I thought we were on the same team here... '

I Think that Steve Kass and CBretana can will join your team, style of a writing is similar to yours, is not that so?

Regards,
Igor
Go to Top of Page

Seventhnight
Flowing Fount of Yak Knowledge

USA
2878 Posts

Posted - 06/18/2005 :  13:54:54  Show Profile  Visit Seventhnight's Homepage  Reply with Quote
Its funny that you post such an example. As the two solutions given to him support every comment I have made about your functions, and neither give credit to your approach. How does this support your position???

Dave asked for the position of the third '/' in a url. This does not support your Occurs or At function as a practical solution because:
- overlaps are completely irrelevant
- in fact, since it is a url, which is why he knows he wants the third '/', it would be better to remove the http:\\ and then just find the first '\' with charindex.
- using your function 'At' would cause a severe slow down in query execution time, not only becuase you are repeatedly calling a udf, but you have that udf calling another!

You obviously don't seem to understand that a 'good' solution is not always the obvious solution. For many people the obvious solution to a task is a cursor, because it is 'easy' to figure out. However, as we have proved around here many times, cursors are quite often one of the worst solutions.

So you are still challenged to produce a practical purpose to count occurances and include overlaps.

So I still maintain that your 'Occurs' & 'At' function are wasted space, as they are not practical efficient solutions that will encourage developers to be mindful of query execution time and cost. They simply empower developers that have no business developing SQL scripts.

P.S. my earlier statement was mistyped, it should read:
I would like to hazard this theory: If a function that returns the starting position of the nth occurance of a specified expression in a character string (including overlaps), is required, then the database design is highly questionable.

Corey

Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now."
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

Australia
4970 Posts

Posted - 06/18/2005 :  21:41:50  Show Profile  Visit Merkin's Homepage  Reply with Quote
quote:
Originally posted by Seventhnight


Hey! I thought we were on the same team here... (i said he was an average developer)



Sorry, it's an old SQLTeam joke.... something said by one of our first crackhead trolls...



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

Igor2004
More clever than you

Canada
78 Posts

Posted - 06/19/2005 :  13:45:22  Show Profile  Visit Igor2004's Homepage  Reply with Quote
Dear, Corey

I am glad to that that you have learned from me about two mode of calculation of ocurrences,
admit that earlier you about this did not know.

"Its funny that you post such an example"
It is an example of practical requirement

It is possible to write functions AT, RAT, OCCURS using two ways
1) include overlaps
2) exclude overlaps
I consider that all three functions should use a uniform way of search of ocurrences.
Let's admit functions AT, RAT, OCCURS - include overlaps
and functions AT2, RAT2, OCCURS2 - exclude overlaps

Both have the right of a way to existence-important that the user knew as his functions work

Argument in support of calculation of ocurrences (include overlaps)
Consistency at any lines
Let's assume
declare @cSearchExpression varchar(10), @cExpressionSearched varchar(50)
select @cSearchExpression = 'ww', @cExpressionSearched = 'www'
select dbo.OCCURS(@cSearchExpression, @cExpressionSearched) -- DISPALY 2
-- last ocurrence found by means RAT of equal to the first ocurrence found by means of AT
select dbo.RAT(@cSearchExpression, @cExpressionSearched, 2) -- DISPALY 1
select dbo.AT(@cSearchExpression, @cExpressionSearched, 1) -- DISPALY 1
-- the first ocurrence found by means RAT of equal to last ocurrence found by means of AT
select dbo.RAT(@cSearchExpression, @cExpressionSearched, 1) -- DISPALY 2
select dbo.AT(@cSearchExpression, @cExpressionSearched, 2) -- DISPALY 2


Calculation of ocurrences (exclude overlaps, faster ) on some lines it is inconsistent
select dbo.OCCURS2(@cSearchExpression, @cExpressionSearched) -- DISPALY 1
-- last ocurrence found by means RAT2 of NOT equal to the first ocurrence found by means of AT2
select dbo.RAT2(@cSearchExpression, @cExpressionSearched, 1) -- DISPALY 2
select dbo.AT2(@cSearchExpression, @cExpressionSearched, 1) -- DISPALY 1


If the length is equal 1 that it is possible to use always faster algorithm (having increased the size of a code for mine functions)

That visitors of a forum think of it?
___________________________________________________________________________________

Please answer following questions
How you qualify yourselves? (average, good, very good etc)
Why you have tried to write unnecessary function ?
Why you have not offered your theory from the very beginning ?
___________________________________________________________________________________
"but you have that udf calling another"
It is made for reduction of a code. If to whom to be necessary to change collation settings, he will make it in one place in function CHARINDEX_BIN.

___________________________________________________________________________________

That you would advise to Dave !
"- in fact, since it is a url, which is why he knows he wants the third '/', it would be better to remove the http:\\ and then just find the first '\' with charindex."
This line characterizes you as the developer,
And if the fourth ocurrence he at first is required will remove the http:\\
and then just find the first '\' and already then just find the second '\' .
Such "ingenious" decisions fill the Internet, therefore the Internet name "information garbage can"
It is difficult to find that or good!
Part (members of one team with you) will examine each concrete case.
The part of developers will prefer to write simply select dbo.AT()

The quantity of people using my functions grows every day, they prefer to save time and efforts.
Use of your way existed and earlier, it remains and now, my functions give a choice.
Function OCCURS is one is there are still others.
Once again I repeat, if and to members of your team my functions are not necessary - do not use my functions.
You can to continue to remove the http:\\ and to move the http:\\
to remove and to move , I'd like to move, move, I'd like to remove, remove
Regards, Igor.
Go to Top of Page

Seventhnight
Flowing Fount of Yak Knowledge

USA
2878 Posts

Posted - 06/19/2005 :  16:39:32  Show Profile  Visit Seventhnight's Homepage  Reply with Quote
Please answer following questions
How you qualify yourselves? (average, good, very good etc)
I'd like to like to think that I am at least above average, but I do realize there are plenty of things that I am not experienced in. What I find important is the research involved in making the right decision for each specific situation.
Why you have tried to write unnecessary function ?
What idiot would right an unnecessary funtion?? If its unnecessary why would i waste my time writing it?? You are the one who has a whole collection of unnecessary functions that are misleading lazy developers.
Why you have not offered your theory from the very beginning ?
I did offer my opinion from the beginning. I think that a generalized function that has mo obvious practical purpose is a bad idea and a waste of time. What more of an opinion do you want?

Since you are unable to produce a practical use where the At or Occurs function would be required (and by 'required', I mean that it would be the cleanest, fastest, and most logical solution), I will just continue believing that such example does not exist.

I don't support making lazy developers lazier. I had a coworker that downloaded code from the internet (from people such as yourself). He has been gone for 1.5 years now, and we have almost finished rewriting every single line of code that he produced. See, the problem was that he could download the code, but he didn't understand how anything worked, so in essence, it is the 'easy to download and use' crap on the internet that allows people like him (who have no business in development) to get development jobs.

Oh... and I think you broke your translator, because the last post was really hard to read

Corey

Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now."
Go to Top of Page

Igor2004
More clever than you

Canada
78 Posts

Posted - 06/19/2005 :  19:40:26  Show Profile  Visit Igor2004's Homepage  Reply with Quote
"I did offer my opinion from the beginning. I think that a generalized function that has mo obvious practical purpose is a bad idea and a waste of time."
Your first post in discussion
"I'm very clever too

how about this for an occurs function (with overlaps)

It doesn't even have a while loop

Create function dbo.occurs
(
@iStr varchar(4000),
@fStr varchar(100)
)
Returns smallint As
Begin
Declare @rStr varchar(100)
Select @rStr = case when charindex(left(@fStr,1),@fStr,2)>0 then stuff(@fStr,charindex(left(@fStr,1),@fStr,2),0,'~') else Replicate('~',datalength(@fStr)+1) end

Return(datalength(Replace(Replace(@iStr,@fStr,@rStr),@fStr,@rStr)) - datalength(@iStr))
End"

"we have almost finished rewriting every single line of code "
I represent what code you have written if your code is similar on previous !
Code of the hardworking developer (with errors) !
Maybe your employee could not work with you, where he is now?

"downloaded code from the internet (from people such as yourself)"
Unfortunately in the Internet is not enough reliably code (from people such as myself)
The Internet full the code (see above) from people such as yourself !

"Oh... and I think you broke your translator, because the last post was really hard to read "
You can write though two words in foreign language ? For instance, I speak French.
Go to Top of Page

Seventhnight
Flowing Fount of Yak Knowledge

USA
2878 Posts

Posted - 06/19/2005 :  21:47:37  Show Profile  Visit Seventhnight's Homepage  Reply with Quote
quote:
Since you are unable to produce a practical use where the At or Occurs function would be required (and by 'required', I mean that it would be the cleanest, fastest, and most logical solution), I will just continue believing that such example does not exist.


As I said in my last post, you have proved nothing as of yet. Since the burden of proof is yours, I must give up on the hope that you will be able to support your position with evidence of some sort.

PS. I never claimed to speak any lanquages other than English, so I don't think it helps me at all that you speack french.

Seventhnight... out.

Corey

Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now."
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

USA
4184 Posts

Posted - 06/19/2005 :  23:59:38  Show Profile  Visit derrickleggett's Homepage  Send derrickleggett an AOL message  Send derrickleggett a Yahoo! Message  Reply with Quote
Coño!!!

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

elwoos
Flowing Fount of Yak Knowledge

United Kingdom
2050 Posts

Posted - 06/20/2005 :  04:07:41  Show Profile  Reply with Quote
For what it's worth I think Corey has a valid point. If there are no practical applications why were they written in the first place? Were they perhaps an academic exercise?


steve

Alright Brain, you don't like me, and I don't like you. But lets just do this, and I can get back to killing you with beer.
Go to Top of Page

Seventhnight
Flowing Fount of Yak Knowledge

USA
2878 Posts

Posted - 06/20/2005 :  09:11:42  Show Profile  Visit Seventhnight's Homepage  Reply with Quote
quote:
Originally posted by derrickleggett

Coño!!!

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.



Does that mean what I think it means??

Corey

Co-worker on The Wizard of Oz "...those three midgets that came out and danced, the freaked me out when I was little. But they are ok now."
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 06/20/2005 :  09:55:49  Show Profile  Reply with Quote
Well Google can't translate it...

In any event, this entire thread is all academic....

When you have someone whoe doesn't want to listen or understand, it's a waste of key strokes....

And oh, thousands of downloads...great, there are a lot of people out there who will willingly take bad advice...why is that so unusual?

And SQL team is what, up to a million hits a day now?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

Kristen
Test

United Kingdom
22431 Posts

Posted - 06/20/2005 :  10:37:54  Show Profile  Reply with Quote
"Well Google can't translate it..."

Indeed, but there are some interesting sites a Google search points to. Including one which Google translates, from Spanish, as "Like eating a coño"

Kristen
Go to Top of Page
Page: of 5 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000