SQLServerCentral - www.sqlservercentral.com

A community of more than 1,600,000 database professionals and growing

Featured Contents

Featured Script

The Voice of the DBA

Are You Always Up?

I've had the opportunity to work for and with quite a few companies in my career. In some sense working as a database developer or database administratrator is very similar at many places. The "job's the job," as I've said in more than a few interviews, as I often ask to meet with others and better understand the environment. I'm rarely sold on the technology in use, usually more concerned with management and co-workers, though you might view employment differently.

At the same time, it can be amazing how different the environment may be and how varied the requirements are for my application and systems. One employer was a small, but busy and growing import/export company. We stretched the limits of technology at the time, and it was a challenge to meet the desires of management. At the same time, we were primarily a weekday, roughly 9-5 shop and I had the opportunity to bring down systems at night or on weekends for maintenance.

This was in contrast to my prior position at a nuclear power plant. There systems were expected to be up 24x7, with (grudgingly) scheduled maintenance once a quarter. That was the environment with the most stringent requirements, though I also learned over time that I preferred to have a bit more latitude in how I could architect systems or manage databases. Though that was when I had children, and I might be willing to work in a similar environment now.

Many of you probably have varying requirements by application, but I suspect more of you are expected to keep systems up more often than in the past. It seems the world has moved to a greater dependency on database platforms, with the expectation that the data is always available.

When you plan upgrades or maintenance, can you work with a flexible schedule? Or are changes always carefully managed? I'm sure some of you prefer one type of environment over the other, so chime in today with your preferences and restrictions. I'm sure some of you work in less busy organizations, and I'm curious if that's the case. 

Steve Jones from SQLServerCentral.com

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


The Voice of the DBA Podcast

Listen to the MP3 Audio ( 3.7MB) podcast or subscribe to the feed at iTunes and Libsyn. feed

The Voice of the DBA podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music.

ADVERTISEMENT
ReadyRoll

Database migrations inside Visual Studio

Feeling the pain of managing and deploying database changes manually? Redgate ReadyRoll creates SQL migration scripts you can use to version control, build and release, and automate deployments. Try it free

Redgate Hub

Watch SQL in the City Streamed 2017

The livestream recording for Redgate's December 2017 virtual event is now available. Technical sessions went into the latest Microsoft SQL Server releases, and covered topical issues such as DevOps, data compliance, protection & privacy. Watch the recording

Featured Contents

 

How to Upgrade SQL Server

Rudy Panigas from SQLServerCentral.com

What steps should you take in upgrading SQL Server to SQL 2014 More »


 

How Can DevOps Concepts Provide Value in Digital Transformation Projects?

For some of us, DevOps means startups, cloud, fast-moving social media applications and Extreme Programming (XP). What about large corporate IT initiatives, Digital Transformation projects, and business process re-engineering? Can DevOps be relevant and appropriate? Mohammad Rizvi argues from experience that it most certainly can be. More »


 

The Database DevOps Challenges SQL Clone Solves

With its PowerShell integration, SQL Clone becomes an important component in a broader database DevOps toolchain - Tony Davis explains in detail. More »


 

From the SQLServerCentral Blogs - Getting Started in a SQL Server 2017 VM in Azure

Grant Fritchey from SQLServerCentral Blogs

You say you’re ready to dip your toes in the Azure ocean? Come on in, the water’s fine! Oh, you want... More »


 

From the SQLServerCentral Blogs - Dissecting SQL Server, The Internal Structure of a Row

david.fowler 42596 from SQLServerCentral Blogs

I’m sure that most of us know that SQL Server stores all it’s data in 8Kb pages.  But what do... More »

Question of the Day

Today's Question (by Steve Jones):

I've got this table and data:

 CREATE TABLE TheCounts ( intcol INT , charcol CHAR(10) , varcharcol VARCHAR(100) , datecol datetime2 ) GO INSERT TheCounts VALUES (1, 'West', 'Denver Broncos', '2018-01-01') , (2, 'West', 'Oakland Raiders', '2018-01-01') , (3, 'West', 'Los Angeles Chargers', '2018-01-01') , (4, 'West', 'Kansas City Chiefs', '2018-01-01') , (5, 'South', 'Jacksonville Jaguars', NULL) , (5, 'South', NULL, '2018-01-02') , (6, NULL, 'Indianapolis Colts', NULL) , (7, NULL, 'Houston Texans', NULL) , (NULL, 'North', 'Pittsburgh Steelers', NULL) , (NULL, 'North', 'Baltimore Ravens', '2018-01-03') , (NULL, 'North', 'Cincinnati Bengals', NULL) , (NULL, 'North', 'Cleveland Browns', NULL) , (13, 'East', 'Cleveland Browns', '2018-01-04') , (13, 'East', 'Cleveland Browns', '2018-01-04') , (14, 'East', 'Cleveland Browns', '2018-01-04') , (14, NULL, 'Cleveland Browns', NULL) 

What do I get when running this code?

 SELECT COUNT(DISTINCT 'North') FROM dbo.TheCounts AS tc 

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 in this category: count().

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

Securing SQL Server: DBAs Defending the Database

Protect your data from attack by using SQL Server technologies to implement a defense-in-depth strategy, performing threat analysis, and encrypting sensitive data as a last line of defense against compromise. The multi-layered approach in this book helps ensure that a single breach doesn't lead to loss or compromise of your data that is confidential and important to the business. Get your copy from Amazon today.

Yesterday's Question of the Day

Yesterday's Question (by Steve Jones):

I've got a table with the points scored by every NBA player in their career. I decide I want to find out the ranking of various players. I have this query:

 WITH cteLeaders AS (SELECT prs.firstname , prs.lastname , totalpts = SUM(CAST(prs.pts AS INT)) FROM dbo.player_regular_season AS prs GROUP BY prs.firstname , prs.lastname ) SELECT TOP 10 cteLeaders.firstname , cteLeaders.lastname , cteLeaders.totalpts, PERCENT_RANK() OVER (ORDER BY cteLeaders.totalpts) FROM cteLeaders ORDER BY cteLeaders.totalpts desc 

In the resul;ts, Kareem Abdul-Jabber shows as the highest point total player. What is his percent rank?

Answer: 1

Explanation:

Percent_Rank() returns a decimal number that is between 0 and 1, determining where the row is in relative rank with others. The highest value, which is at the top of the ranking, gets a 1. The lowest gets a 0.

Ref: PERCENT_RANK() - click here

Nast Fast PERCENT_RANK - http://www.sqlservercentral.com/articles/PERCENT_RANK/141532/


» Discuss this question and answer on the forums

Featured Script

How to read an audit file

Evgeny Garaev from SQLServerCentral.com

The script reads data from audit files for a particular audit in a tabular form.

That is an answer for a question from our fellow member - https://www.sqlservercentral.com/Forums/1916789/Audting-User-Logins-How-might-you-do-it . But I have decided to share it because it may be useful for other members.

In order to use it you have to replace {NameOfYourAudit} with the name of the audit on your SQL Server instance. That audit must be a file target audit. You also can filter the events which you are interested in by uncommenting the where clause and changing {MyStatement}. You can apply your own filters as well, for example you can use: client_ip, application_name, server_principal_name, and many other fields for filtering. Apart from custom filtering you can apply the custom ordering by changing the order by clause.

You can find more information about sys.fn_get_audit_file on the Microsoft web site - click here

More »

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 : SQL Server 2017 - Development

A Different Problem with Full Details - Hey guys,  I have a SQL problem. 1-) Firstly mine sql design ; 2-) Default SQL query

Strange Problem ??? - Hi guys, My code : Select A.price1, B.price2 from  (SELECT Top 100 tarih, coin, MIN(price) AS price1 FROM dbo.cointahmin  GROUP BY tarih, coin order...

Is learning Python/R an advantage for SQL Server Developers? Need an expert advice. - Hello Guys, Is it time for SQL Server Developers to start learning R/Python to excel in their career? Expert advice needed.


SQL Server 2016 : SQL Server 2016 - Administration

Should I add indexes to a log table? - Dear all, I have below table in my Data Warehouse. This table has just the function of storing the executions times of...


SQL Server 2016 : SQL Server 2016 - Development and T-SQL

Help me in update - complex - hi All,    Hope all are fine create table #sample(id varchar(100), version_no int, set_type varchar(100), set_no int ,XML_NAME varchar(100)) insert into...

ETL and data model design advice needed - I am often required to provide my organization with performance metrics (it is a health care organization so the metrics...

Information_schema, table column_names and view alias names, how do they match. - I am looking in the information schema. I am trying to find the connection between the table column and the view...


SQL Server 2012 : SQL 2012 - General

help with the SELECT statement syntax. - if object_id('tempdb..#rx') IS NOT NULL DROP TABLE #rx GO create table #rx( MemN VARCHAR(15), ClaimNumber VARCHAR(20), RX_Number VARCHAR(20), Claim_Type CHAR(1) ) ; INSERT...

SQL Server to recognize each individual user - What must I do within SQL Server or the SQL Database itself in order for SQL Server to know what...


SQL Server 2012 : SQL Server 2012 - T-SQL

Pivot distinct values only - i need to report on the last six - last day of the month counts by department.  The query below ... [code...


SQL Server 2008 : SQL Server 2008 - General

With Schemabinding - I use With Schemabinding whenever possible, on the theory that it is safer to have things locked up to prevent...

MySQL Linked Server Problem - Hello, I have a problem which is driving me crazy. I need to extract some data from a MySql database into...

Linked server using MySQL ODBC 5.1.8 - Hi , I am trying to add a linked server using the MySQL ODBC 5.1.8 but I am always getting the...


SQL Server 2008 : T-SQL (SS2K8)

Question Regarding Date logic - Hi, I need to get Year, monthname in three letters, startdate and enddate  of the month for last two years...

Strip SAON from the beginning of an address - For those who don't know, a PAON is the part of an address that identifies a building.  A SOAN is...


SQL Server 2008 : SQL Server Newbies

get the last active data - I’m trying to get the last active data and insert that in the current row of the table. Create table...


Programming : Connecting

Update not working after read database using CASE - Hi, hopefully this question is in the correct place. I have a SQL Server 2014 database that I am working...


Data Warehousing : Integration Services

FailParentOnFailure or ForcedExecutionValue -- which to use? - Hi, I have a question that I would appreciate your help on please. The set-up is.... I have a Sequence Container (SC1) that...


SQL Server 2005 : Administering

Idera SQL Complaince - Creating Trace files - I have unstalled the Idera SQL Complaince software on the sql server machine but still the trace files are creating...


SQL Server 7,2000 : T-SQL

Find Affected Row Count from a Dynamic Query - Dear Gurus, Following is my procedure CREATE PROCEDURE prg_SHOW_VIEW_RUNNINGTIME ( @strViewName NVARCHAR(255) ) AS BEGIN DECLARE @strSql NVARCHAR(400) ,@dtStartTime DATETIME ,@dtEndTime DATETIME ,@rowcount INT SET @dtStartTime = GETDATE() SET @strSql = 'SELECT * FROM...

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 ©2018 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved.
Contact: webmaster@sqlservercentral.com