Expert Advice-
It is a Myth that you Need to Sweat Excessively to lose weight.
DocOz reveals the Astonishing Way to drop 1-lb per day:
DocOz Video Clip ->
http://www.cutlerycel.com/drop25/oz/tip.video
This 1-Step regimen will banish belly fat in days.
- no working out - no calorie counting
[DocOz Blog]
To modify message settings write Current Update Alerts 1644 Doral Dr /Brookings, SD 57006 or visit
http://www.cutlerycel.com/4jfr.dk3o
f I may add: The accepted answer doesn't work with tables that uses uniqueidentifier. This one is much simpler and works perfectly on any table. Thanks Martin. This solution worked extremely well, thanks. love it. cleaned up a huge mess for me in no time at all is is the only solution that is workable on my large table (30M rows). Wish I could give it more than +1 Julia Hay is such an awesome answer! It worked event when I had removed the old PK before I realised there where duplicates. +100 replaced Col1, Col2, Col3 with a BINARY_CHECKSUM(*) call in the PARTITION BY CLAUSE and had good results, saved myself specifying 30+ columns on some large tables. suggest asking and then answering this question (with this answer) on
DBA.SE. Then we can add it to our list of canonical answers. Does anyone know how I could return the number of duplicate records in this same query while also deleting them? I believe, while using the With statement, you can only reverence the temporary cte once, correct? DDiVita - If you just want to know how many rows were deleted look in the messages tab in SSMS for the rows affected message for more complicated needs look at the OUTPUT clause. nlike the accepted answer, this also worked on a table that had no key (RowId) to compare on. vossad01 Mar 4 it has synonym syntax: delete t from (select ROW_NUMBER() OVER (PARTITION BY name ORDER BY (SELECT 0)) as rn from @table) t where Great solution as can also be used on tables with a compound primary key. Just FYI this article on codeproject works as e Already mentioned in this answer. Unless you are stuck on SQL Server 2000 that seems unnecessarily cumbersome and inefficient compared with ROW_NUMBER though. Martin Smith Mar 2 at 11:53
Otaku, I definitely recommend keeping this question focussed on exactly what it means to say VB is case-insensitive and how it's implemented. The question of whether it's better for a language to be case-insensitive may, sadly, start a flame war. If you're really curious, ask it in another question. (I advise you not to, but if you must then tag it subjective and make it community wiki) MarkJ Feb 22 '10 at 10:22
@MarkJ - yeah, I hear ya. The question on whether or not it is case sensative was emphatically answered, and that is what I was really looking for. On the why sensitive/insensitive is better/worse, I was trying to see if there was an exact technical "better" like x386 chips are faster than x286 chips but it appears that there isn't a technical reason (that was supplied) so I don't think the second question could be answered. Todd Main Feb 22 '10 at 16:23
11
You are (or were) thinking about this upside down. It's precisely because the compiler is case-insensitive that the error reads 'variable SS already declared'. If it was case-sensitive you'd get either a 'ss variable not used' or no error at all and a bug if you used alternatively one and the other. Adriano Varoli Piazza Mar 15 '10 at 19:02don't think Jared meant it's only the IDE. I think he has said the compiler is case-insensitive, so it thinks ss is identical to SS, but also as an aid to reading the IDE corrects SS to ss as you type. So even if the IDE didn't correct the case, the compiler would still see the two identifiers as identical. still fail to understand why it would be a good thing to have more than one name represent different things by just case difference in the name" <-- I felt the same way before switching from VBA/VB6/
VB.NET to C#, I thought that having names only differ by cases seemed outright dangerous. In practice, though, it proves to be quite useful, and, surprisingly, not prone to errors at all. I very much disagree with that point. I've never seen mixed cased names which did anything but cause confusion.Really? I mean something like void SetColor(color Color){this.color = color}; I realize that this might look dangerous, but it works smoothly, the compiler won't let you make a mistake, and IntelliSense gives you the correct members after "color." vs. "Color.". The thing that bothers me here is that the use of "this" is not required -- it's enforced by FxCop and/or StyleCop (I forget which), but I wish there were a setting to have the IDE always enforce this when accessing class members instead of potentially allowing the scope to be accidentally shadowed. now lets look at the equivalent in
VB.NET, which is: Private Sub SetColor(ByVal color As Color) Me._color = color End Sub In this case, however, 'color' now shadows 'Color' and it is therefore impossible to access 'Color' without the full path 'System.Drawing.Color'. In order to get around this, and allow commands such as color = Color.Red,
VB.NET allowed static members to be accessible via an instance, so one can now write color = color.Red. Mike proved to be a huge mistake that the
VB.NET team wishes that they could take back , but the goal was to get around a limitation of case-insensitivity. The solution was far worse than the original problem, which was a very small one.
Overall, with a lot of experience in both
VB.NET and C#, I would say that the case sensitivity issue hardly matters, but I do feel that the added flexibility of allowing case-differences outweighs the potential problems, which, for reasons that are difficult to explain, seem to be small in practice. (I had expected big problems with this when I first switched from
VB.NET to C#, but, in reality, I haven't seen any.) You're describing a scenario where identifiers in different scopes differ by case only. I'm not objecting to that. I'm objecting to the notion that identifiers defined in the same scope with names only differing by case only leads to confusion. definitely, that would be an insane idea. Totally greed. But, overall, given the flexibility that a case-sensitive language allows (including some really bad uses of it, as you point out), I find the extra flexibility to be a small plus. The flip side is that when using
VB.NET, I find that I have to prepend variable names with "the" or "my" to compensate, which is a bit unfortunate. Mike