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

The 2016 Home Lab

Everyone needs a home lab. At least, everyone that works in technology and wants to grow their career or get better at their craft. I'd hope that's most of you, but if not, that's fine. If you're happy with just cruising along at work, I wish you the best.

For many people, especially those wanting to learn, they need some lab. There are plenty of free software choices you can make to build a lab. SQL Server, SSMS, Visual Studio Code, Virtual Box, you can get these for free. The thing you'll need to provide is the hardware. From my own experience, to learn about many features, you'll want at least 2-3 VMs, or instances that can run different versions, provide some separation, and even a spare instance when you blow one up. If you want to experiment with the AlwaysOn technologies, you might want 4 or 5 spaces. You can do lots of this in Azure, but many people don't want to commit, or have open ended costs. Or they don't want to eat up bandwidth.

I'm not a hardware geek, and honestly don't care what I run. It just needs to go fast and work well. I rebuilt my desktop, on advice from Glenn Berry, but I just followed advice. I didn't try to determine if part A was slightly better or worse than part B. I just needed the SSD/MB/CPU/etc. to work.

I'm sure plenty of you might be considering a lab, or might need to upgrade. I ran across two great posts that give you a few ideas on what might work for you. Allan Hirt showcases a great portable lab, which I may adopt as a traveling companion. However, if you want another desktop that might run a slew of VMs for experimenting with SQL Server features, Glenn Berry from SQLskills has his own post that you can use for advice.

If you've got recommendations or ideas, or questions, please add them to the discussion. If you're proud of your own setup, let us know. If you have found Azure (or AWS) to be a friendly, cost-effective place for a lab, I'm sure people would love to know that as well. 

Steve Jones from SQLServerCentral.com

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

ADVERTISEMENT
SQL Compare

New Redgate SQL Compare 12 has landed!

SQL Compare 12 has landed with a brand new user interface, support for SQL Server 2016, and a wealth of fixes and improvements. Check out this blog post from Redgate's Carly Meichen to hear more about what’s new, why the team have built it, and how. Read now.

SQL Prompt

How can you help your team write better, shareable SQL faster?

Find out by discovering 15 Super SQL Tips from Microsoft MVPs and other SQL Server experts. Using SQL Prompt to write, refactor, and share SQL, they show how it strips away the repetition of coding and standardizes it everywhere. View the tips and download a free trial.

DLM Patterns & Practices

Free Webinar – Redgate DLM Demo

Learn how to use Redgate’s DLM solution to improve your database change management process in this free webinar on October 18th. Microsoft Data Platform MVPs, Steve Jones, and Grant Fritchey, will demonstrate how Redgate’s tools plug into Git, Jenkins & Octopus Deploy so that you can build, test and deploy your database alongside your application code. Register now.

Featured Contents

 

Level 2 - The Ideal SQL Server Virtual Machine Architecture

David Klee from SQLServerCentral.com

In Level 2 of the Stairway to SQL Server Virtualization, we examine the ideal VM configuration from a standpoint of the various resources involved. More »


 

DELETE Operation in SQL Server HEAPs

Additional Articles from SimpleTalk

You should stick to using tables in SQL Server, rather than heaps that have no clustered index, unless you have well-considered reasons to choose heaps. However, there are uses for heaps in special circumstances, and it is useful to know what these uses are, and when you should avoid heaps. Uwe Ricken explains, and demonstrates why you'd be unwise to use heaps rather than tables when the data is liable to change. More »


 

How to create a directory of object-level scripts using SQL Compare

Additional Articles from Redgate

It’s often useful to be able to create a directory of object-level scripts from an existing database, for example to put a database into version control, or search through a directory of scripts. In this simple ‘how to’ article, Feodor Georgiev expands on the four most common reasons, and shows how simple it is using SQL Compare. More »


 

From the SQLServerCentral Blogs - An observation about Unicode in SQL Server Management Studio

Daniel Janik from SQLServerCentral Blogs

A week or so ago I read a blog post and tweet about using an emoji in SQL Server. This... More »


 

From the SQLServerCentral Blogs - Special Discount for PASS Summit Precon

kleegeek from SQLServerCentral Blogs

I’m very honored to be speaking at the PASS Global Summitagain this year in Seattle during the week of October... More »

Question of the Day

Today's Question (by Steve Jones):

How can I execute an R script in SQL Server 2016?

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: Microsoft R Services.

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

Microsoft SQL Server 2016 Reporting Services

Build, publish, and maintain paginated and mobile reports using the expert tips and best practices contained in this hands-on guide. Written by a member of the original Reporting Services development team, Microsoft SQL Server 2016 Reporting Services, Fifth Edition, fully explains the process of creating and distributing reports and shows how to maximize all of the powerful, integrated SSRS capabilities, including the new and enhanced features. 

Get your copy from Amazon today.

Yesterday's Question of the Day

Yesterday's Question (by Steve Jones):

Which query will return the value "Trevor Siemian" from this document?

 declare @x xml = '<teams>   <team name="Cowboys">     <players roster="active">       <player position="QB" depth="1">    <name>Dak Prescott</name> <college>Miss. St.</college> <year value="rookie" draftposition="5">1</year>  </player>       <player position="RB" depth="1">    <name>Ezekial Elliott</name> <college>Ohio St</college> <year value="rookie" draftposition="1">1</year>  </player> </players>   </team>   <team name="Broncos">     <players roster="active">       <player position="QB" depth="1">    <name>Trevor Siemian</name> <college>Northwestern</college> <year value="veteran" draftposition="7">2</year>  </player>       <player position="LB" depth="1">    <name>Von Miller</name> <college>Texas A and M</college> <year value="veteran" draftposition="1">6</year>  </player> </players>   </team> </teams> '; 

Answer: @x.value('(teams/team[2]/players/player/name)[1]','varchar(250)')

Explanation:

This is an XQuery structure that requires you to traverse the hierachy of the document. In this case, we know we need to get to the player's name. That means working through:

teams/team/players/player/name

In our case, we have two "team" elements, so we want to pick the correct one. Since XML is 1 based, we want team[2]. We could use the @name="Broncos" as well.

We then need to get to the name element, and choose item 1. This is the third query.

The first query will return a null since the [0] is incorrect. The second item gets player 1, but team 1, which is incorrect. The last query returns all the values under the player node, which include the college and year.

Ref: SQL Server 2005 : Intro to XQuery - http://www.sqlservercentral.com/articles/2840/

Stairway to XML: Querying XML Data - http://www.sqlservercentral.com/articles/Stairway+Series/+Querying+XML+Data/92784/


» Discuss this question and answer on the forums

Featured Script

Recompile All Databases stored Procedures

Mark Huber from SQLServerCentral.com

this iteration of the steps will recompile( or more correctly mark for recompilation ) all stored procedures in all the databases.

You could easliy add an AND and and further filtering to only work with just the objects you are needing to recompile.

I have had a few issues where I renamed and database and the execution plans were pointing to the old database and it was trying to use and offline database. So I created this. Once I ran this there were no more issues and all the procs execution plans were fresh.

Thanks for looking. 

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 2016 : SQL Server 2016 - Administration

DBCC CHECKDB error - Hi, I am getting the following error when i run DBCC CHECKDB on my database. Msg 7928, Level 16, State 1,...


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

Help: Truncate tables with same prefix - I apologize for any short comings in advance as I am not all that familiar with SQL. I need to...


SQL Server 2012 : SQL 2012 - General

Hacking the Report Server Database - Hi, Not sure if anyone has any advice here. I'm doing data driven subscriptions without enterprise edition and I've hacked together...

SQL Server v Access re:security - Hi how do people view the security (or lack of it) between SQL server and MS Access ? Would anyone use MS...


SQL Server 2012 : SQL Server 2012 - T-SQL

Query Performance - Hey guys Just looking if anyone else can advise on an improvements (if any can be made to a query I'm...

Synch 2 tables; performance - We have 2 tables with the same schema on different servers. Let's call them TblSrc and TblDest. We need to...

insert into table with foreign key constraint - In a sql server 2012 database, the first insert statement works that is listed below works: insert into [dbo].Cust (custid,[number],lockid) values...

Need some help with query - I have got following data in my table machine_id type_id attribute_name attribute_value 1 1 issuer0 cn=test 1 1 issuer1 cn=test1 1 1 NotAfter0 1/1/2016 1 1 NotAfter1 1/1/2016 1 1 NotBefore0 1/1/2016 1 1 NotBefore1 1/1/2016 1 1 subject0 cn=test 1 1 subject1 cn=test1 I would like to have it formatted/returned like below machine_id typ

query and compare values in a text based column - HI There, as the heading suggests I am trying to query a text based audit for specific values then compare them...


SQL Server 2008 : SQL Server 2008 - General

sql query to display a trailer record at the end in txt file (using batch file) - hello, I want to display a trailer record at the end of records : the spec is as follows Trailer Record: Field Name Length Begin ...


SQL Server 2008 : T-SQL (SS2K8)

Using SP in UDF - I am trying to create a function that will generate a random datetime value. Due to being unable to use...


SQL Server 2008 : SQL Server Newbies

How to get the table name from a objectID? - Hi I am trying to find the name of a table in our database given a objectID, when i run this select...


Programming : General

Want to learn SQL - Dear Friends, Please suggest me some sites to learn SQL online. Thanks in advance.


Data Warehousing : Integration Services

Environment variables set up - I have created a project parameters at my solution level and after i deploy the solution to the server ,at...


Data Warehousing : Analysis Services

MDX Calculated Measures not affected by slicers - Hi! I'm new with this howl MDX thing and cant seem to figure out how to make the following work. I...


SQL Server 2005 : Administering

power script to find backup status in sql server - Hi All, I need a power-shell script to obtain the following information Name of the database , LastBackupDate of the database and...


SQL Server 2005 : Development

Evaluate each field from source to target and update - Hi, I have a request where i have to check if ID exists ,If ID exists then update. However client wants...


SQL Server 2005 : SQL Server 2005 General Discussion

Database Mail - I am new to SQL 2005 and am not a DBA. I have questions for setting up Database Mail. I...


SQL Server 7,2000 : Administration

SQL 2000 cant not login using servername\Instancename - Hello, After sql server restart I've noticed that I [b]can[/b] login remotly only using: instancename instancename,port IP,port But [b]can not [/b]login using only: Instancename...


SQL Server 7,2000 : T-SQL

create a table on a 2nd SQL server via linked server - I guess the title explains everything, but I was wondering if anyone had a method of my being able to...

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