| A community of more than 1,600,000 database professionals and growing |
| | Start Fixing Your DB with Better Code I ran across an interesting article from Gitlab. They host git repositories for companies that develop software, and of course, part of their hosting is tracked in a database. They use PostgreSQL for their data, and were not happy with the performance of their database backing the system. Up front they admit part of the issue is their own coding, which is likely the problem in so many software projects. Gitlab accepted this, and certainly many database developers or consultants will let management know that the problem causing poor performance is often poorly written code. Jeff Moden constantly explains in his articles how better code can dramatically reduce the load on your SQL Server, yet fixing code is often the one thing few organizations want to focus on. It's easier to buy more hardware, which often just hides the problem for am all-too-short period of time. Or just complain and try to write new features that take the place of old ones. I'm sure many of you have heard your parents or teachers tell you it takes about as long to do something right as wrong, so do it right the first time. Often taking a shortcut doesn't really save time. I'm not sure that's true with development. Often it's quicker to do it wrong because doing it right takes a little more planning, and perhaps some testing, likely a bit more time to carefully construct code, and certainly more time to learn how to write code better. That last item is the issue, as so many of us learn to write code poorly, without examples that give us good habits from the start. The best developers have spent lots of time writing code poorly and learning how to improve their work. They know the tips and tricks in their language(s) of choice. That might be better SQL to create efficient queries, better C# to avoid constantly hitting the database, or something else. However, as most of us learn to write code, we don't learn the best way. We learn the ways that are easiest to teach a user concepts, most of which don't scale well. If you've made the investment to learn about writing better code, then it doesn't take any longer to write good code from the start. If you've made the investment, and if you practice what you've learned. Jeff has lots of great articles on writing better code, as do many of our other authors. Take a few minutes today and learn to build better SQL code. Your database (and users) will thank you. Steve Jones from SQLServerCentral.comJoin the debate, and respond to today's editorial on the forums |
|
| ADVERTISEMENT | | Don’t just fix SQL Server problems, prevent them from happening SQL Monitor helps teams looking after SQL Server be more proactive. Not only does SQL Monitor alert you to current issues, it gives you the information you need to stop them happening in the future. Download SQL Monitor now and get a 14 day free trial |
| | Could your SQL coding be more efficient? Data Platform MVPs and SQL Server experts share their tips on how to standardize formatting whilst stripping out the repetition of coding with SQL Prompt. Over these 20 short videos we will help you write better, shareable SQL faster. Check out the tips |
|
|
|
| | | Steve Jones from SQLServerCentral.com Learn how to get your custom messages from an existing instance and add them to a new instance. More » |
| Additional Articles from MSSQLTips.com There is a built-in command called msiexec which has an uninstall parameter (-x). This command can be used to remove stubborn programs through brute force. First, though, you need to get an inventory of the GUIDs that represent the programs you need to remove. More » |
| Microsoft MVP and PASS President Grant Fritchey dispels the myth that database DevOps and compliance can't go hand in hand. After a brief look at how extending DevOps to the database lays solid foundations for data governance and compliance, the focus will then shift to guidance around the upcoming GDPR. Register now. More » |
| From the SQLServerCentral Blogs - A View On ViewsRoland Alexander STL from SQLServerCentral BlogsIn my experience, there are few database objects more poorly understood, misunderstood, misused, and outright abused, than the humble view.... More » |
| Microsoft introduced some major changes in SQL Server Integration Services with SQL Server 2012. Brand new “SSISDB” database launched as SSIS... More » |
|
|
| | Today's Question (by Devendra Thakur): Which are the valid MDX functions? (select 4) |
Think you know the answer? Click here, and find out if you are right. We keep track of your score to give you bragging rights against your peers. This question is worth 1 point. We'd love to give you credit for your own question and answer. To submit a QOTD, simply log in to the Contribution Center. |
|
|
| |
ADVERTISEMENT | Exam Ref 70-761 Querying Data with Transact-SQL Prepare for Microsoft Exam 70-761–and help demonstrate your real-world mastery of SQL Server 2016 Transact-SQL data management, queries, and database programming. Designed for experienced IT professionals ready to advance their status, Exam Ref focuses on the critical-thinking and decision-making acumen needed for success at the MCSA level. Get your copy from Amazon today. | | |
|
|
|
|
|
| Yesterday's Question of the Day |
| Yesterday's Question (by Avinash): Sometimes we need to share a variable or session state across different batchs in same session. For example, the second part of the below script will return an error since @i is not available in that conext. DECLARE @i INT = 100 SELECT @i GO SELECT @i Which of the below options can be used to store values in a SQL Session (SQL 2016), so that it can be accessed in all the batches of a script in the same session? Answer: sp_set_session_context Explanation: The system stored procedure, sp_set_session_context, can be used to to set a key-value pair in the session context. As soon as the session is closed memory will be releasd. SESSION_CONTEXT(KEY) is used to get the value of the specified key. Ref: click here Note: CONTEXT_INFO() can also be used for sharing data between context in same session, but it holds only one value in binary format and length is limited to 128. Ref: https://docs.microsoft.com/en-us/sql/t-sql/functions/context-info-transact-sql » Discuss this question and answer on the forums |
|
|
| Database Pros Who Need Your Help |
| Here's a few of the new posts today on the forums. To see more, visit the forums. Is it preferred to keep the SQL server Min memory to 0 (default)? - Hi Seeking expert opinion to know what is the preferred option / value for SQL Server Min Memory? Indexing Issue - Hi, I have the following temp table listed below. In the interface we created the user has the option to enter in... Shared stored procedure with very complicated input - So, the basics of what I want to accomplish is simple...I have a stored procedure that has some really complex... Kerberos Delegation for linked server / specific authentification protocol - Hey there, altough this is not a specific SQL Problem, I hope it nevertheless the correct category to place it in... What is the best ways of storing unstructured data in sql server 2016, except filestream. - What is the best ways of storing unstructured data in sql server 2016, except filestream. Odd behavior with views - Hi all, My coworker recently told me about an odd situation he encountered with views. He found that when he issued... A way to restaure backup skipping some filegroups... - Hello, A have to restaure a huge database (PROD) on a smaller environment (STAGE). My database is split in filegroups, I... How to resolve one to many linkage - CREATE TABLE .( NOT NULL, (50) NULL PRIMARY KEY CLUSTERED ( ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS... Operating system error 5: "5(Access is denied.)". - Hi Can anybody advise me, what is wrong or what am i doing wrong? Trigger after update not working when updating 2 or more rows - Hello, whats wrong here, when I update only one row everything is fine. But when there are more then one rows,... Should this index be clustered? - I have a table that is heavily used which inserts and deletes rows frequently during the day. This is just... Query to give sum of items with condition from multiple tables - I have these tables: LineItemSubParts, CostCodeSubCategories, CostCodes and LineItems In the LineItemSubParts table there are fields named Quantity, MQuantity and Cost In the CostCodes... "Cannot open user default database. Login failed" - Good Morning Experts, User received the below error while trying to connect to an instance "Cannot open user default database. Login failed" I... S?QL Server using 97% of RAM. - Good Morning Experts, SQL Server is using 97% of RAM. Could you please advise what needs to be done. ExecutionLogStorage table and Subscriptions table - Is there a way to get only the ExecutionLogStorage rows that correspond to a particular subscription in the Subscriptions table? I'd... Sum for year within Tablix - Hi I have a report that I am trying to do that is filtered by what period the user enters.... T-SQL Statement Task not running when scheduled - I had the same issue when just pasting in syntax as a SQL job where it runs the syntax as... Excel drivers for ssis package - Hi, I am trying to connect to excel source but its throwing connection error. After googling it suggested my system might... Basics of Statistics (data distribution) - I would like a basic article to explain how statistics are captured for SQL Server tables and updated (auto/manual). A... GREATEST and LEAST function - Hi, I'm looking for a function in T-SQL for getting the biggest or the smallest value between two or more columns... |
|
| This email has been sent to newsletter@newslettercollector.com. To be removed from this list, please click here. If you have any problems leaving the list, please contact the webmaster@sqlservercentral.com. | This newsletter was sent to you because you signed up at SQLServerCentral.com. Feel free to forward this to any colleagues that you think might be interested. If you have received this email from a colleague, you can register to receive it here. | This transmission is ©2017 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. Contact: webmaster@sqlservercentral.com |
|
|