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

Byte Me: Plugged in

Bob Lang from SQLServerCentral.com

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

ADVERTISEMENT
SQL Source Control

How to track every change to your SQL Server database

See who’s changing your database, alongside affected objects, date, time, and reason for the change with SQL Source Control. Get a full change history in your source control system. Learn more.

SQL Toolbelt

Not enough hours in your day?

The SQL Toolbelt lets you reduce the time spent on SQL Server development and administration. Cambridge University developer David Spaxman, for example, says: “I’m saving 10-12 hours a week using the SQL Toolbelt.” Learn how you can double your productivity, speed up deployments and protect your data. Download a free trial.

SQL Clone

SQL Clone – create database copies fast!

Create copies of production databases and SQL backups in seconds and save up to 99% of disk space using SQL Clone. Redgate’s new tool removes much of the time and resource needed to create and manage database copies, allowing teams to work on local environments to develop, test and diagnose issues faster. Join the beta.

Featured Contents

 

Stairway to Biml Level 6 - Programming with Metadata

Reeves Smith from SQLServerCentral.com

In this next level of the Stairway to Biml, learn how metadata makes your Biml code more efficient and helpful in generating packages. More »


 

Free eBook: Fundamentals of SQL Server 2012 Replication

Press Release from Redgate

Fundamentals of SQL Server 2012 Replication provides a hands-on introduction to SQL Server replication. The book introduces you to the technologies that make up replication, and then walks you through setting up different replication scenarios. When you've finished reading, you should be able to implement your own multi-server replication setup while following the principle of least privilege. More »


 

Find and Remove Duplicate Rows from a SQL Server Table

Additional Articles from MSSQLTips.com

Though duplicate rows are bad practice, sometimes they're necessary for a short time. But how do you clean your tables when they're no longer needed? Sergey Gigoyan provides a few different solutions. More »


 

From the SQLServerCentral Blogs - Stored Procedures Are Not Faster Than Views

Grant Fritchey from SQLServerCentral Blogs

A performance tuning tip I saw recently said, “Views don’t perform as well as stored procedures.” <sigh> Let’s break this down, just... More »

Question of the Day

Today's Question (by Steve Jones):

I want to export the results of this query in my database:

 SELECT * FROM dbo.Customers WHERE Active = 1 

I decide to use sqlcmd to query the database and export the results to the file, customers.txt. What command should I use to export data and immediately exit sqlcmd?

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: SQLCMD.

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

Training Kit (Exam 70-463) Implementing a Data Warehouse with Microsoft SQL Server 2012

The Exam 70-463 Training Kit for Implementing a Data Warehouse with Microsoft SQL Server 2012 helps maximize your performance on the exam by learning how to design and implement a data warehouse, develop and enhance SQL Server Integration Services packages, manage and maintain SQL Server Integration Services packages, build data quality solutions, implement custom code in SQL Server Integration Services packages.  Get Your Copy Today

Yesterday's Question of the Day

Yesterday's Question (by Junior Galvão - MVP):

Introduced in Microsoft SQL Server 2014 SP2, DBCC CloneDatabase aims to allow the investigation of performance problems in a query. This DBCC command has some usage restrictions. What are they?

Answer: The source database must be a user database, cloning of system databases (master, model, msdb, tempdb, distribution database etc.) isn't allowed, the source database must be online or readable, a database that uses the same name as the clone database must not already exist and the command isn't in a user transaction.

Explanation:

Answer: The source database must be a user database, cloning of system databases (master, model, msdb, tempdb, distribution database etc.) isn't allowed, the source database must be online or readable,
a database that uses the same name as the clone database must not already exist and The command isn't in a user transaction.

ExplanationThis update introduces a new management command DBCC CLONEDATABASE (Transact-SQL) in Microsoft SQL Server 2014 Service Pack 2. This command creates a new database that contains the schema of all the objects and statistics from the specified source database. 

ReferencesHow to use DBCC CLONEDATABASE to generate a schema and statistics only copy of a user database in SQL Server 2014 SP2 - https://support.microsoft.com/en-us/kb/3177838


» Discuss this question and answer on the forums

Featured Script

Build restore scripts dynamically

Brian R.A. Smith from SQLServerCentral.com

Save this script on each SQL instance to be restored, and open it in Management Studio. Set the @BackupPath variable to the parent folder where the server's backup files exist, run the script, and copy the output results to a new query window. You can then either run the entire script at once, or restore each database individually.

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

File Group Backups and Restore - Morning All, I have a database, with a filegroup that is 2TB of documents (blob data). I frequently have restore this database...


SQL Server 2014 : Administration - SQL Server 2014

Query returning incorrect results randomly - Hi Team, I'm running a simple SQL query which returns a set of columns based on a search criteria. It has...

Table valued fucntion or scalar valued function - I have a productCase table that we created cases for some products. Then there are some other tables related with...

Cluster Node Down - Hi Experts, One of our node in a 2 node SQL cluster is down . Checked the Port 3343 is open , no...

MSDB jobs in DB mirroring and AlwaysOn availability group - Hi all, As we have already know -> system databases are not mirrored nor replicated in both mirroring and alwayson availability...


SQL Server 2014 : Development - SQL Server 2014

How to use a CSV as parameter in a query - I always used a query with an(one) integer parameter, but now it has to change to more integers in the...

SUM and Group using IN clause - Hi, I am looking for a way to create a query to SUM and Group BY by using IN clause...

Drill down values... - Hi, I've an orders table with customer and supplier (customer_id, supplier_id, order_id, order_date, ...) Is it possible to get the total orders...

Completing Fixed Sets With Another Table - Hi, I'm having some trouble finding a solution to a problem, its been a few hours now and I think I...


SQL Server 2012 : SQL 2012 - General

Current options for data-change notification on a vendor-schema (unalterable) - I've got more and more applications popping up in my enterprise environment that would benefit from being notified when information...


SQL Server 2012 : SQL Server 2012 - T-SQL

Need help with a SQL "least significant digit" algorithm - Hi all, Looking for some quick help with a bit of SQL. The best way I can describe it is that...

Get records which satisfy particular condition and exclude others - I have the following data with client account decision and status Client fields value 111 Decision accept 111 Status deposited 112 decision accept 113 Decision accept 114 Decision accept 114 Status contract 115 Decision Conditional Accept 115 Status deposited 116 Decision Conditional Accept 117 Decision Conditional Accept 118 Status contract 118 Decision Conditional...

Big data: transfer x-number of rows per batch? - Hi all, I must transfer a big table (231k rows not that big, but 735GB big because of blob) to another...


SQL Server 2008 : SQL Server 2008 - General

Get data between 3PM and 2AM - This data represents visits to our Emergency Room. I need to pull the records for patients that were registered between...


SQL Server 2008 : T-SQL (SS2K8)

Username increment by 1 if already exists in table - Hi All, I am having user table as below Create table #TEMP_USER ( ID int identity (1,1) , USERNAME nvarchar(50) ); I want to insert...


SQL Server 2008 : SQL Server 2008 High Availability

Migrating Data from SQL server 2012 to Data Warehouse - Hi, What do you think is the easiest way to migrate data from Sql server to data warehouse


Programming : SSDT

SSDT Not Updating Database - We're using Visual Studio 2013 SSDT to generate deployment scripts for database changes and have found some strange behaviour. The project...


Data Warehousing : Integration Services

Need to implement left join using look up - I have a stage table S and new columns from other table T , i want to do left join on...


SQL Server 2005 : Administering

Setting up Database mail using gmail account - Hi,, any one any idea about this? I am trying to set up Databases mail on my laptop and I have...


SQL Server 7,2000 : SQL Server Agent

error 1067-sql server agent - While starting sql server agent service on my server it is giving following error: error 1067 :the process terminated unexpectedly I have...

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