|
REPLACE(dvel.Notes, '
', ' ')
T-SQL: Replaces newline with space.
Last modified: 4hrs 41mins after originally posted --
Pits fall into Chuck Norris.
|
|
|
|
|
In what language?
|
|
|
|
|
Sorry, T-SQL. Fixed now.
Pits fall into Chuck Norris.
|
|
|
|
|
Bah, small fries.
I've seen:
Something = ISNULL(somecolumn, NULL)
|
|
|
|
|
What if the newline was also followed by a carriage return. Would you end up with a sequence of space, carriage return? That's pretty bizarre.
|
|
|
|
|
It's replacing a 'literal' new line, so it would replace the CRLF combo with a space. The horror is not explicitly saying, DON'T REMOVE THIS LINE BREAK!
Pits fall into Chuck Norris.
|
|
|
|
|
\n would have been better here
|
|
|
|
|
Then the replace should happen before the data hits the database.
|
|
|
|
|
Technically, it is. The query is to extract data destined for a target database that doesn't like newlines. It's an edge case, as other target databases are happy with the newlines.
Pits fall into Chuck Norris.
|
|
|
|
|
Uah looks terrible.
|
|
|
|
|
I don't see it, obviously the guy who wrote that used XVI32 and doesn't see anything wrong with it...
|
|
|
|
|
Spacix
One wrote: doesn't see anything wrong with it...
That's the horror. What don't you see? The ambiguity between a line wrap and a line break in a SQL statement?
Pits fall into Chuck Norris.
|
|
|
|
|
Well, I mean the guy who wrote it must have been using a Hex editor and the link break was just another two bytes to him, as he could only see "0D 0A" which looks normal, to him...
-Spacix
All your skynet questions[ ^] belong to solved
I dislike the black-and-white voting system on questions/answers.
|
|
|
|
|
Recently came across this gem.
<br />
protected void Foo()<br />
{<br />
PreProcess(arg);<br />
}<br />
<br />
<br />
private void PreProcess(string arg)<br />
{<br />
try<br />
{<br />
return;<br />
}<br />
catch(Exception ex)<br />
{<br />
}<br />
}<br />
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson Because programming is an art, not a science. Marc Clifton
|
|
|
|
|
Future extension?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
probably the coder wants the program to do nothing..
.....
|
|
|
|
|
Spunky Coder wrote: probably the coder wants the program to do nothing
probably the coder do nothing wants to program.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Spunky Coder wrote: probably the coder wants the program to do nothing..
Just because it does nothing doesn't mean nothing can go wrong!
Steve
|
|
|
|
|
This is to catch the possibility of that the function failed to return.
The code in the catch should then be
protected void Foo()
{
PreProcess(arg);
}
private void PreProcess(string arg)
{
try
{
return;
}
catch(Exception ex)
{
main();
}
}
codito ergo sum
|
|
|
|
|
Yeah there are many exceptions that can be thrown by the return instruction...
|
|
|
|
|
The function will ALWAYS return. The try{ return; } are the first 3 lines in the method & where the PreProcess() is called is already wrapped in a try..catch block.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson Because programming is an art, not a science. Marc Clifton
|
|
|
|
|
like it...
try to return... if you fail, catch the exception and return...
if you can...
(yes|no|maybe)*
|
|
|
|
|
I cannot begin to imagine how the person who wrote this code thinks...
|
|
|
|
|
MarkBrock wrote: I cannot begin to imagine how the person who wrote this code thinks...
A couple of judicious edits and, voila:
"I cannot imagine the person who wrote this code thinks."
|
|
|
|
|
Don't be so hard on the programmer. There might be couple of reasons for this. May be code skeleton was written to be filled later. Maybe there was function body was well but over time it was removed but function itself was not removed.
-Saurabh
|
|
|
|