SQLServerCentral - www.sqlservercentral.com

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

Featured Contents

The Voice of the DBA

Byte Me: Killer Conference

Bob Lang from SQLServerCentral.com

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

ADVERTISEMENT
SQL Clone

New SQL Clone: Now supporting databases up to 64TB

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. Try it free

SQL Compare

The industry standard for comparing and deploying SQL Server database schemas

Trusted by 71% of Fortune 100 companies, SQL Compare is the fastest way to compare changes, and create and deploy error-free scripts in minutes. Plus you can easily find and fix errors caused by database differences. Download your free trial

Featured Contents

 

SQL Azure Reporting Automation

Tushar Kanti from SQLServerCentral.com

This article will talk about preparing a runbook in Azure to schedule the report of space usage of databases in Azure environment More »


 

Free eBook: SQL Server Backup and Restore

Press Release from Redgate

In this free eBook Shawn McGehee offers advice on query tuning, cutting stored procedures, and system process design and implementation for high availability. Discover how to perform backup and restore operations using SQL Server Management Studio (SSMS), basic T-SQL scripts and Redgate's SQL Backup tool. More »


 

Six reasons to version control your database

For most application developers, it's unthinkable to work without version control. What about the database? What's stopping you version controlling yours? More »


 

From the SQLServerCentral Blogs - Microsoft Data Insights Summit Day 1 Recap: Power BI Visio & PowerApps Integration, Custom Drill Through Actions, Book Marks, What If Analysis, & Data Insights

dustinryan from SQLServerCentral Blogs

If you were at the Microsoft Data Insights Summit or were watching the live stream of the keynote, then you... More »


 

From the SQLServerCentral Blogs - Understanding Relative Risk – with T-SQL

Mala Mahadevan from SQLServerCentral Blogs

In this post we will explore a common statistical term – Relative Risk, otherwise called Risk Factor. Relative Risk is a... More »

Question of the Day

Today's Question (by Carlo Romagnano):

 Select 2 correct answers about the result set of the OUTPUT clause

 CREATE TABLE a(cod VARCHAR(10),description VARCHAR(100)) CREATE TABLE b(cod VARCHAR(10),processed bit) GO INSERT INTO a SELECT * FROM (VALUES ('A','AAAA 1') ,('A','AAAA 2') ,('A','AAAA 3') ,('A','AAAA 4') ,('B','BBBB 1') ,('B','BBBB 2') ,('B','BBBB 3') ,('B','BBBB 4') ,('C','CCCC 1') ,('C','CCCC 2') ,('C','CCCC 3') ,('C','CCCC 4') ) AS V([cod],[description]) GO INSERT INTO b SELECT *,0 FROM (VALUES ('A') ,('B') ,('C') ,('D') ,('E') ) AS V([art]) GO UPDATE b SET processed = 1 OUTPUT deleted.*,a.* FROM b FULL JOIN a ON a.cod = b.cod WHERE b.processed = 0 

(How many rows returned and which values for the description column or any syntax error).

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: T-SQL.

We'd love to give you credit for your own question and answer.
To submit a QOTD, simply log in to the Contribution Center.

Yesterday's Question of the Day

Yesterday's Question (by Steve Jones):

What are my options for the first Raiserror parameter? The second and third parameters are severity and arguments.

Answer: A message ID, a string, or a local variable that can be converted to char/varchar

Explanation:

The first parameter can be a message ID in sys.messages, a string containing a message, or a local variable that can be converted implicitly to char/varchar.

Ref: Raiserror - click here


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

SQL Server Single User Mode - Situation? - Hello, Can anybody please make me understand that under which situtaion a DBA will have only one option that to start...

SQL server upgrade to new version - We are currently using SQL server 2014 and SQL server 2012. I am planning to upgrade them in Oct to SQL...

Error 17049 (OS error:5 Access Denied) DBCC Errorlog - Hi Experts, While recycling error log using command - DBCC Errorlog , I am facing the below error. Unable to cycle error log file...


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

Convert unicode escape sequence to nvarchar - Hi all, I have string like this: DECLARE @m NVARCHAR(max)= N'\u0633\u0644\u0627\u0645' How can I convert(Unescape) it to normal string ?

SQL: HOW to concatenate two fields using trigger, - Hi All, I have SQL database called “S1”, and a table called “WORKORDER”, inside the table, I have two field...

Missing months group by - My data is like below currently- 7 columns below in first table. Date                Country       P1      P2      C1      C2       R1 2017-03-01       IN              0...


SQL Server 2014 : Administration - SQL Server 2014

Reseeding indexes for tables with data - Hello, I have a database with many tables containing auto-incrementing Pk's.  Somehow, things got messed up and an insert against a...

SQLJOBVIS - anyone still have a copy? - This is the nifty old utility talked about in this article. http://www.sqlservercentral.com/blogs/chadmiller/2010/05/15/sql-agent-visual-job-schedule-viewer/ It seems the company and the website no longer...


SQL Server 2014 : Development - SQL Server 2014

Dynamic Pivot using XML as column list - I am trying to pull out a list of products from a product table, in the form of a comma...

How does this code convert records to a single row? - Hi I stumbled across some SQL code which seems to transpose record data into a single record. Unfortunately the code was...


SQL Server 2012 : SQL 2012 - General

Scalar function with source conditional to a parameter - My code is as follow ALTER FUNCTION . (@SC1 varchar(30)) RETURNS VARCHAR(3) AS BEGIN DECLARE @LB VARCHAR(3)         SELECT TOP 1 @LB=Buyer         FROM vPurch_Q       &n

Parse SQL String - Hi, What's the best way to only get "place of work 234" from the Product code?  I tried the sql below...


SQL Server 2012 : SQL Server 2012 - T-SQL

Create Auto Insert Script - 500k records to load data into sql server - Hi, I would like to Create Auto Insert Script - 500k records to load data into sql server for my testing. How can...

Need Suggestions on Best way to Query Data - Greetings, I have a table that has 2 columns, TransTableDetail_Trans_To and TransTable_Description. the TransTableDetail_Trans_To column lists store numbers that can repeated...


SQL Server 2008 : SQL Server 2008 - General

How to get these queries into a view? - Hello, I have some data I'm trying to summarize and I'd like to have this in a queryable view instead...

Programatically return Login name for DBO user? - Hi all, My Google skills seem to have failed me here!!   Any ideas? Thanks, JB


SQL Server 2008 : T-SQL (SS2K8)

Tsql Query help - Hi guys, I am working on a process where the query to be written seems little tricky to me. I have...


SQL Server 2008 : SQL Server 2008 Performance Tuning

SQL behaving strangely on different servers - Hi All, I have a sql statement working on static tables (no Insert,Update,Delete) on our testing server it's running very fast...


Reporting Services : Reporting Services

ssrs 2008 report with truncation problem but no issue exists with sql in ssis manager - In an existing ssrs 2008 report, I want to chage a hard coded value of 'P' to use a parameter...


Data Warehousing : Integration Services

"Is not in path" error? - I am not sure exactly what this error is.  We had a hard drive crash not too long ago and...

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