Problems displaying this newsletter? View online.
SQL Server Central
Featured Contents
Question of the Day
The Voice of the DBA
 

Daily Coping Tip

Remember that all feelings and situations pass in time.

I also have a thread at SQLServerCentral dealing with coping mechanisms and resources. Feel free to participate.

 

For many of you out there working in a new way, I'm including a thought of the day on how to cope in this challenging time from The Action for Happiness Coping Calendar. My items will be on my blog, feel free to share yours.

Keeping Unique Aliases

I am a big standards guy. Not any particular standards, but ensuring you have some in your organization and that people stick to them. Pascal case, Camel case, it doesn't matter to me. I'll build a habit with any of them; I just want some consistency from others working in a team. Or even across teams since people move to different projects over time.

I ran across another post on naming conventions, this one looking at SQL standards, and it's a practical look at a few things. I like some of the ideas, like the singular or plural choice (" Who cares. Just pick one and use it consistently. "), but I especially like the idea of the third item: standard aliasing.

In the past, I've often found that I used the same aliases over and over. When I was the only DBA, this ensured consistency. "P" was always for dbo.Product, and pc was always used for ProductCategory. However, when we added other team members, I quickly realized we didn't use the same conventions. I'd check out code and see prod.productid instead of p.productid. The new people didn't like my single character aliases and I didn't like typing most of the word for theirs.

Ultimately we had to decide what made sense for both of us and compromise. We choose specific items, not all at once, but as needed. We'd have a 30s meeting or exchange a quick chat message and then update a document with the standards. When other new developers were hired, they already had a reference list that they quickly learned.

I think the idea of standard aliases makes sense. It's built into SQL Prompt and some other tools, precisely because many teams want to ensure their developers adhere to a standard, and more importantly, can quickly understand any code they pick up. That's the real reason for standards: they convey information, silently and quickly.

Steve Jones - SSC Editor

Join the debate, and respond to today's editorial on the forums

 
 Featured Contents

Your First Pipeline with Azure Data Factory

Richard Swinbank from SQLServerCentral

Learn how to build your first Azure Data Factory Pipeline

Getting Started with CQRS – Part 3

Additional Articles from SQLServerCentral

Diogo Souza completes his series on CQRS. He demonstrates Event Sourcing to capture the data as it flows through the system which can then be analyzed without affecting the source.

From the SQL Server Central Blogs - Using Pester to Improve Operational Tasks

Sheldon Hull from Sheldon Hull

Taking the Time To Test
Requirements in a constant state of change set you up for failure.
Failure to work through requirements before starting can also increase the risk of failure.
Planning...

From the SQL Server Central Blogs - How to edit a connection in Azure Data Studio

carlos10robles from DBA Mastery

Did you ever want to rename an existing connection in Azure Data Studio? Unfortunately as of today (April 2020), there is no way to modify an existing connection group or...

 

 Question of the Day

Today's question (by Steve Jones - SSC Editor):

 

Tempdb Default Size

I've installed SQL Server 2017 with all the defaults (clicking next, next, next where I can). I took the recommendations for tempdb. This gave me 8 data files. What is the total size of my tempdb data space by default?

Think you know the answer? Click here, and find out if you are right.

 

 

 Yesterday's Question of the Day (by Steve Jones - SSC Editor)

Rounding Fun

I am looking to round a value, and decide to try a few things. I am planning on using these functions:

  • ROUND(x, 0)
  • FLOOR(x)
  • CEILING(X)

I pass in the value -7.7

Which two of the three functions return the same value (ignoring decimal values to the right of the decimal)?

Answer: ROUND() and FLOOR()

Explanation: Both ROUND() and FLOOR() return the same value here for the negative number. Ref:

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.


SQL Server 2017 - Development
Find percentage of column - Hi, I'm trying to find the percentage of a column but I'm not sure how to get the percentage correct. The attachment is how I'm getting the "Have" part. I've tried adding this column but when I do a group by rollup it does the percentage on the overall total and not by county total. […]
Slow Trigger performance when big batches - I have an update trigger that inserts into auditing tables. We had no problem until someone decides to update over 1 million records... (That's my bad. I didn't think it would be a problem when developing). Now facing reality, I need to find a solution... This is a simplified version of the real thing -- […]
How to Join two tables with conditions and insert into new table - Hi,   I have two tables, both the tables have 4 common columns, First Column: LinkingID Other four columns(Name,Department,City). In few instances, we will get LinkingID row values, and few instances we don't have LinkingID column, so we left to use other 3 common columns), I want to see the best way to handle this […]
SQL Server 2016 - Development and T-SQL
Parent-Child Hierarchy - Finding the root - Hello, what I am trying to do is to find the root for every id. declare @tab table (id nvarchar(3), Father_id nvarchar(3), Flag_Root bit ) insert into @tab values ('A1','A1',1) insert into @tab values ('A2','A1',0) insert into @tab values ('A3','A2',0) insert into @tab values ('B1','B1',1) insert into @tab values ('B2','B4',0) insert into @tab values ('B3','B1',0) […]
Update duplicate values to 0 - Hi, I need some help in my query. Want to change numbers to 0 if the row is a duplicate records based on uniqueness of 2 columns Condition 1 ) ID and Market Condition 2 ) ID,PL For the Same ID and Market , I want to retain one row of original values in MarketComplete […]
SQL - queries - Hi, Based upon the attached table relationships, could somebody please help in the SQL queries for the following questions - Question 1  - Select time elapsed in days between the case date for cases created in the second half of 2010 and its first quote. If no quote has been created yet find elapsed time […]
Administration - SQL Server 2014
Backup and log files - I am a newby here. My data was destroyed and I was able to find another backup on a drive. I do have a complete database from January. However, I have two additional files that do not show with a file extension. One for each of the following months. I think these are log files […]
SQL Server 2012 - T-SQL
Encryption option in 2012 - Hi Experts , Our database have sensitive information like SSN , Tax_id etc. There are many such tables and don't want to use the column encryption and decryption by opening the symmetric key etc. Is there any other way to encrypt the data in sql server 2012.  
Trying to find the date of a day for each month - Hi, I have been looking allover and trying different things for this but cannot see hot to do this. In an VB.Net application the users will select 1st, 2nd, 3rd, or 4th. from one dropdown box and the day from another. this is a payment application, where the users enter when an customer is going […]
SQL Server 2019 - Development
Count the number of Code Types with a Subquery - I need help with a query to select against the following table: CREATE TABLE dbo.Claims ( [Organization Name] nvarchar(64) NOT NULL, [POS Code] nvarchar(8) NOT NULL ); GO -- In the real dataset there are many organizations -- ORG 1 Inserts INSERT INTO dbo.claims ([Organization Name], [POS Code]) VALUES ('ORG 1','02:B:1'); INSERT INTO dbo.claims ([Organization […]
Conversion failed when converting the varchar value ' ' to data type int - Hello, What I am trying to do is to replace the null values that I initially populated my table with using the update statement. I receive the error: 'Conversion failed when converting the varchar value 'THISWILLBETHESTRING' to data type int'. Keep in mind that in the update statement the TEST.ORDERCODE comes from the same table […]
EF Code-First - What is the DBA world consensus on using this to implement databases for an application? An application developer presented this as the "future of EF" but I do not know much about "EF Code-First" but it looks like its coding the database as classes in a .NET app and then applying it to a database. […]
SQL Server 2008 Administration
Merge Replication problem after table deletions - Hi Overnight we deleted 4 million rows out of on table on the subscriber database with merge replication enabled on it. The deletion took 2 hours but only 1.6 million records replicated across. There was a query timeout error in replication monitor. We restarted replication and this query runs and eventually times out, even when […]
SSRS 2014
Extra Row in Report Save as CSV - Using SSRS 2014, I'm getting an extra row at the bottom of the file when I save a report as a CSV file. Is there something I can add to the reportserver.config file? Thank you  
SSDT
Cannot browse cube from within Visual Studio -The \'Tabular View\' feature is not - Hi expects I am getting the below error when i am trying to browse a cube from visual studio cube browser. "Errors related to feature availability and configuration: The 'Tabular View' feature is not included in the '64 Bit Standard' edition of Analysis Services. (Microsoft SQL Server 2014 Analysis Services)" Why is it  trying to […]
 

 

RSS FeedTwitter

This email has been sent to {email}. 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.
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
webmaster@sqlservercentral.com

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -