Skip to main content
14 votes
Accepted

A wounded Zombie finder, or: how to find the almost dead undead?

Not utterly wrong, but q.PostTypeId = 1 and AND a.PostTypeId = 2 are superfluous. The only post types with a non-null ...
Glorfindel's user avatar
  • 1,113
9 votes
Accepted

App for providing accounting solutions for clients

You only asked for suggestions how to make this code faster. However, after discussing what might be the issue with performance here, I will provide some comments regarding general maintainability ...
M.Doerner's user avatar
  • 1,530
8 votes

Accounting system data database design

Some quick remarks: Why the (incomprehensible) prefixes in the table names? Why not use the SCHEMA instead (and use proper words)? Why are all your table fields ...
BCdotWEB's user avatar
  • 11.4k
7 votes
Accepted

Zombie killers ranking

As a heads up - we have very different formatting styles for our code. Feel free to ignore that difference and don't consider it a comment on your style (unless you prefer mine, in which case please ...
Dan Oberlam's user avatar
  • 8,049
7 votes

NewSequentialId - pure net core 2.2 implementation of sql server function

You want to reduce both computation time and memory allocation. Memory allocation itself takes time, so that's a good place to start -- try to find all the places where you're allocating memory and ...
Jeff's user avatar
  • 860
7 votes

Write SQL Server table to Parquet file

Quick remarks: Your code doesn't follow the coding conventions (camel-case, pascal-case, etc.). string SourceObject_IsTable = args[2]; has a bad name and isn't ...
BCdotWEB's user avatar
  • 11.4k
6 votes

Employee Attendance structure design

I would change my parameters to simply require "login" and "logout" timestamps. Then calculate the difference between those two DateTimes. I would move all validation into DI ...
Morten Bork's user avatar
5 votes
Accepted

Connection String Decorating

What struck me most are these lines: p.Name.ToUpper() != name.ToUpper() I find it's always better to use the Equals overload ...
t3chb0t's user avatar
  • 44.7k
5 votes
Accepted

Multilingual website with a database

Too many Language Repetitions You use the "Language" key a lot. What if you decide to rename it sometime? You'll need to search ...
t3chb0t's user avatar
  • 44.7k
5 votes

Retrieving data from SQL DB based on user input

I don't get the point of the ConnectionString class. Just about any example WRT writing db access code will use a connection string taken from a ...
BCdotWEB's user avatar
  • 11.4k
5 votes
Accepted

The sniper: a Zombie searcher for specific tags

When using "simple" Aliases for table names in a query you should alias all the tables, not just some of them. This makes the query appear more consistent. In your query, you have ...
rolfl's user avatar
  • 98.2k
5 votes

Safe dynamic SQL for generic search

Comments on your approach The most obvious thing to me is that you're already inserting all of your data into the temp table; why not just join to it? You can dynamically pivot into a better, ...
Dan Oberlam's user avatar
  • 8,049
5 votes

Export sql data to xml and csv

Some quick remarks: Don't start variable names with underscores unless they're class-wide private ones. Local variables should be camelCased. ...
BCdotWEB's user avatar
  • 11.4k
5 votes

Retrieving restaurant orders from SQL Server

Quick remarks: Please follow the Microsoft naming guidelines. Parameters should be camelcase, same with local variables. Don't write your own ORM or use ADO.NET. Instead, use Dapper. In the middle ...
BCdotWEB's user avatar
  • 11.4k
4 votes

"How can I make this SEDE query better?" (bad title finder)

Let me address a possible DRY issue in the query in exchange for possible poorer performance. I'm in particular talking about this bit: ...
rene's user avatar
  • 295
4 votes
Accepted

Adding data to database using asp.net and sql-server

I would personally encapsulate your instantiation of MusicStoreDBEntities in a using statement so that the database connection is properly closed and disposed of. <...
Sean T's user avatar
  • 181
4 votes
Accepted

Adding data to database using ASP.net and SQL-server part 2

Coding/naming conventions: All the information about this can be found in folllowing article: Naming Guidelines. Straight from the documentation: To differentiate words in an identifier, capitalize ...
Abbas's user avatar
  • 5,623
4 votes

Materiel position query for a war game written in Unity

I don't know how much you're looking to change, but making three separate server calls is going to bite you later on when it turns into a huge bottleneck. I would recommend making one request, which ...
Ed Marty's user avatar
  • 141
4 votes

SqlCommand ExecuteReaderAsync helper method

DataContext [..]the creation of the DataContext seems a bit excessive Why do you think so? Is creating the SqlCommand not excessive? You are instantiating it the ...
t3chb0t's user avatar
  • 44.7k
4 votes
Accepted

Creating SQL Indexes on Large Tables

Community wiki because the root of the answer (use an MLT to copy the data) was already in the comments. Shoutout to dnoeth and Der Kommissar for already explaining most of this in the comments. ...
4 votes

Find how much reputation a user had on a given date

This is a partial answer as these were the bits I could verify easily. In your column query for ReputationFromSuggestedEdits you can move all of the projection to ...
rene's user avatar
  • 295
4 votes
Accepted

Inserting data into SQL-Server table dynamically

The main problem with this code is that it's not screening column values, unfortuantely buit in mechanisms in Invoke-SQLCMD aren't viable. It allows to use ...
Bohdan Mart's user avatar
4 votes

Function to get current value or default from a string of two values

Potential Issues a naive string replacement could change more than just the placeholders; for instance, when another part of the script uses the same string as a literal the replacement can introduce ...
dfhwze's user avatar
  • 14.2k
4 votes
Accepted

Function to get current value or default from a string of two values

Answering your question Overall, I think the solution is sound, but there are a few things you could make cleaner. I agree with everything in dfhwze's answer, but assuming this is the route you keep ...
Dan Oberlam's user avatar
  • 8,049
4 votes
Accepted

Excel to SQL server

Time constants Rather than writing tick_time_seconds = 300 you're better off using a more expressive built-in: ...
Reinderien's user avatar
  • 71.1k
4 votes
Accepted

Export sql data to xml and csv

Your biggest problem targeting performance is the use of string concatenation by using exportCSV +=. Each time such a line will be executed a new string object will ...
Heslacher's user avatar
  • 51k
4 votes

Receive data from SQL and CSV and send it to MySQL database using Python

Externalize your connection strings This information: ...
Reinderien's user avatar
  • 71.1k
4 votes

Accounting system data database design

Top 100 percent in a view is useless. Get rid of that. It does NOT ensure the order that rows will be returned from the view and logically it wouldn't work anyway as you could have conflicting order ...
Sean Lange's user avatar
3 votes
Accepted

Performance concerns for synchronous action methods

How large does a database have to be with how many calls to it before the async overhead is worth it? You will have benefits immediately. SQL Server is a multi-user database and even for small/simple/...
Adriano Repetti's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible