|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
The Funny SELECTs | |
What is returned from this query? SELECT ( SELECT COUNT (*) FROM Sales.SalesOrderHeader AS soh WHERE soh.OrderDate > '01/01/2011' AND soh.OrderDate < '01/01/2012') AS OrdersIn2000 , ( SELECT COUNT (*) FROM Sales.SalesOrderHeader AS soh WHERE soh.OrderDate > '01/01/2012' AND soh.OrderDate < '01/01/2013') AS OrdersIn2001 , ( SELECT COUNT (*) FROM Sales.SalesOrderHeader AS soh WHERE soh.OrderDate > '01/01/2013' AND soh.OrderDate < '01/01/2014') AS OrdersIn2002; | |
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) |
A Strange Query What does this return? SELECT x=1 WHERE (SELECT 1) IN ( 1, 2, 3) Answer: A single column, single row result set Explanation: This returns one column and one row in a result set with a 1. The column is named x. No great ref, but a fun one courtesy of Erik Darling: Performance Pains With NOT IN And NULLable Columns In SQL Server |
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 - Administration |
Microsoft Recommendations for Update Stats? - I have an application team that is insisting on daily (and for some, weekly) jobs for UPDATE STATISTICS WITH FULLSCAN on all their databases. These jobs were created years ago by a previous DBA team. The jobs are running very long, into business hours often, one database's job is running 1.5 days, and butting heads […] |
SQL Server 2016 - Administration |
Possible SQL 2014 to 2016 Issue - Some Application Functions Slow/Failing - First time here...hoping I can find some direction and answers so I can devise a proper solution. Novice Basic SQL experience over the years while being the "jack of all trades' IT support, not a DB admin by any means. Issue: After vendor Application upgrade and SQL upgrade from 2014 to 2016 we cannot process […] |
SQL Server 2019 - Administration |
Rebuild Index Job on a Large DB - We have a db close to 3 tb and rebuilding/ reorganizing indexes weekly is taking more than 8 hrs.My goal is to reduce the time job is taking. Can anyone suggest a workaround, I'm interested on how the job can be managed in large environments, considering the maintenance window we are given is limited. We […] |
Authentication Error 0x8009030c - Hi, I'm using a small database on SQL Server 2019 on Windows 10 Pro. The users are being authenticated when signing onto their PCs by the domain. There has never been an issue before. But obviously something has changed. All the users are getting authentication errors, except myself, I'm setup as the sa and can […] |
Issue with CPU Affinity Configuration on a SQL Server VM with 30 vCPUs - Hello , I'm having an issue with a SQL Server VM that has 30 vCPUs allocated. However, in the server affinity configuration, when I check the "Affinity Mask", it detects only 19 vCPUs. Can someone explain to me why there is a difference between the number of vCPUs allocated to the VM and the number […] |
Agent job security account - Hi All, I have few sql server agent scheduled jobs which are supposed to run as NT Service\mssqlserveragent account however at times it runs using different account. Being novice in this world , I am not able to figure out where to make the change in agent job security to ensure that it only and […] |
SQL Server 2019 - Development |
how to stop command prompt window from appearing when running PowerShell script? - Hi everyone I have a PowerShell script that is run by Execute Process Task in SSIS. Each time I run the task I get a black windows prompt screen appearing. Is it possible to hide that? I found one solution online saying to change WindowStyle option in Execute Process Task to hidden but that doesn't […] |
What is the best index strategy for a table that gets truncated? - Hi everyone My SSIS package does a bulk insert of csv files into a table called tableA. The nature of the data is such that I have to truncate the table before new data is imported with bulk insert. Currently there are no indexes on tableA. TableA has fields symbol, name, trade_date, open_price, high_price, […] |
how can i tell if our db2 driver is ms or ibm or other? - i see this in the definition of a linked server on our wh sql server that i know is db2 based... @provider=N'DB2OLEDB', @provstr=N'Provider=DB2OLEDB;DBMS Platform=DB2/AS400; But unlike the info you can easily see by running the odbc data source administrator for installed odbc driver info, i dont see an oledb admin portal nor do i see […] |
SQL Server Newbies |
normal role member to be able to view list of other role members in his DB - Is this even possible ? Tried with grant but to no avail. [sys].[database_role_members] and [sys].[database_principals] can not be accessed even with grant . |
SQL Azure - Development |
Blob Storage automated downloads - Dipping my toes into the waters of Azure and of course before I get past a few introductory videos, I'm tasked with automated a download of files from Azure Blob Storage to a server SAN drive. I've downloaded Azure Storage Explorer and now I'm ready to power-learn, but I have no idea where to start. […] |
SQL Azure - Administration |
Azure elastic job issue authenticating to Azure SQL database - Azure elastic agent jobs: I’m getting this error “The server principal “ac1971e9-381b-449b-9e1a-9cc276fc2985@b5313c9d-fb0d-47af-bc87-7c050bffbdc3” is not able to access the database” when an elastic agent job tries to run against a new database that has been added to an elastic pool. The elastic pool is configured as a target group member. For all other databases in […] |
Connecting |
SSMS 20.2 on Windows11 not able to connect to SQL 2005 ?? - We still have a couple of dino's. What should I check to re-enable access to ye good old SQL 2005 on Windows 2003 for my SSMS 20.2? I have already accepted "use server certificate" and "optional encryption" Still doesn't work; "SSL Connection forcebly closed by server" btw: When using SSMS 18.12.1 it works fine |
SQL Server 2022 - Administration |
Converting job_id to join to another table. - I need help, please! I have a monitoring table that pulls in information about program name (plus sp_who2 does as well), and I need to join it to msdb.dbo.sysjobs to get the job name where the program name starts with SQLAgent (like SQLAgent - TSQL JobStep (Job 0x8FA89775AAF135499FA4CC1621B639FB : Step 1)). Nothing I try is […] |
SQL Server 2022 - Development |
Compare rows within the same table - I have a table. Structure in script below. I have to compare and see if for a job id if the order of taskname is first 'Print' and then 'Distribute' based on the PrintDate column. I have to select rows where the 'Distribute' is coming BEFORE the 'Print' task based on PrintDate column (eg: JobID […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |