|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Database Extended Properties | |
How do I add an extended property on my database with the name, 'Database Use', and the value, 'Test location for scripts and objects'? I am working in the Sandbox database. | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by khwabekhan) |
Minus Query I have the below data set: Employee Table- INSERT INTO EMPLOYEE (PERSONID,FIRSTNAME) VALUES ('1','ANNE') INSERT INTO EMPLOYEE (PERSONID,FIRSTNAME) VALUES ('2','DRIAAN') Person Table- INSERT INTO PERSON (PERSONID,FIRSTNAME) VALUES ('1','ANNE') INSERT INTO PERSON (PERSONID,FIRSTNAME) VALUES ('2','GERRY') I have written this query to fetch the firstname, which is/are present in the employee table but not in the person table and vice versa. Query: (SELECT FIRSTNAME FROM EMPLOYEE ORDER BY FIRSTNAME EXCEPT SELECT FIRSTNAME FROM PERSON ORDER BY FIRSTNAME) UNION (SELECT FIRSTNAME FROM PERSON ORDER BY FIRSTNAME EXCEPT SELECT FIRSTNAME FROM EMPLOYEE ORDER BY FIRSTNAME); Which of the following is the correct output for the above query Answer: An Error Message Explanation: This will throw an error as the ORDER BY cannot be used with EXCEPT() for both query expressions. You can have a single ORDER BY after the right query. Ref: EXCEPT and INTERSECT - https://docs.microsoft.com/en-us/sql/t-sql/language-elements/set-operators-except-and-intersect-transact-sql?view=sql-server-ver15 |
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 |
SQL Auditing and threat detection - Hi all, I wondered if anyone had any experience,words of wisdom, comments on a way to achieve threat detection with SQL Server 2017+. I'm looking at how we can detect things like, an authorised user or activity out of normal hours, anything thats not a norm. I can kind of doing this using audit specifications […] |
DPA for monitoring ? - Hi guys, any one using DPA to monitor their SQL 2017 servers? I am planning to implement this on one SQL server to monitor performance, since this SQL Server always reports slowness from users. Mainly CPU going high. Management gave me 1 license to use SolarWinds DPA, so I can monitor this server. If anyone […] |
Assignment Help - I was wondering if anyone would be kind enough to help me with a couple of queries in my assignment that I have not been able to solve. Consider the following schema for a simple social network. User(uid, first_name, last_name,home_city, bio) Friend(uid_1, uid_2) Message(uid, text, from_city) c)Find the uids of users who are friends with […] |
SQL Server 2016 - Administration |
SQL Agent Jobs running 2 instances at once - I'm having an issue which I'm struggling to find an answer to because the only search terms I can use are too generic. Hopeful this forum will be able to help. I have a server instance running in the simplest of setups (ie no replication) but I'm finding that between 2am and 3am some SQL […] |
SQL Server 2016 - Development and T-SQL |
SQL account for restoring database - I have a script that restores a database and runs some post-restoring actions, mostly fixing the database users. The scripts runs under SQL account ScriptRunner. The RESTORE is fine since ScriptRunner is assigned the dbcreator server role. But how can I run the post-restore script if all database users, including the one for ScriptRunner, are […] |
Administration - SQL Server 2014 |
Nutanix - 'misaligned log IOs which required falling back to synchronous IO’ - Hi I have restored a SQL database onto a nutanix VM, the disks are formatted to 64k. When restoring or running I get error Error: ‘misaligned log IOs which required falling back to synchronous IO’ The database was restored off an old Dell physical 710 server that had disks set to bytes per sector &physical […] |
Development - SQL Server 2014 |
Secured connection to AD with linked server (LDAPS) - Hi, Our system team warn us they detected unsecured connections when one of our linked server try to connet to the AD. We managed to find the concerned request : SELECT * FROM OPENROWSET('ADSDSOObject', 'adsdatasource';'LDAP_LOGIN';'Password', ' SELECT SAMAccountName FROM ''LDAP://ServerName'' WHERE SAMAccountName = ''NameTest'' and objectClass = ''user'' ') After some research, we should use […] |
Index fill factor - Hi Experts , We have around 3000 indexes in our database . We have introduced a index maintenance plan to rebuild the indexes . Now while rebuilding the indexes we have option to specify the FillFactor . My question is that , Is there a way to identify ideal FillFactor for all the 3000 indexes […] |
SQL 2012 - General |
2012 SQL Agent: Reloading agent settings - My SQL Agent 2012 log file is being filled with messages that say "Reloading agent settings". What does this mean and how do I stop it? Some jobs did not run last night and I don't know if this is just a coincidence or is a cause. |
SQL Server 2019 - Administration |
How do I reattach my databases? - Yesterday I went through the process of replacing an old, failing hard drive, out of my Windows 10 Pro machine. I replaced it with an SSD. It gives my old desktop another couple years of use, I hope. I had SQL Server Developer Edition on a second hard drive. Naturally the .MDF and .LDF […] |
SQL Server 2019 - Development |
Integer convert to percent - Having trouble with the below formula. Technically I want to display it by a percentage with two decimal points but when I run the below I get it with over ten numbers to the right. Please help. Seems like a simple thing but I am off with something. ((CAST(COLUMNA as decimal(10,2)))/CAST(COLUMNB as decimal(10,2))) *100 as […] |
Processing Build Item Orders -- do I need a cursor? - say I'm working on a database like AdventureWorks2017 - the standard SalesOrderHeader, SalesOrderDetail (ProductID, QtyOrdered). Then Parts and PartInventory (PartID, LocationID, QtyOnHand)... and I want to know if I have all the "pieces" to build all the items in a SalesOrder. Writing a query to get the quantity of each Part that's required is trivial. […] |
DB Design/Normalization Question - Hello, I've read the posts on this site and elsewhere about normalization -- I have a scenario in a db I'm currently working on where I'd like to get some advice. I am using an Azure SQL Back End/MS Access Front End. About 35 end users. The primary function of the database is to keep […] |
SSRS 2016 |
Sorting by is not giving the expected results - Hello, Im new to SSRS and I was trying to order by SUM(linetotal) in my chart but its not working as expected, even though the query looks fine when I execute it in SQL. im using the advantureworks database and below what I have so far and this is the results that im getting, the […] |
COVID-19 Pandemic |
Daily Coping 1 Jun 2020 - Today's tip is to tell someone about an event in your life that was really meaningful. http://voiceofthedba.com/2020/06/01/daily-coping-1-jun-2020/ |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |