|
|
|
|
|
|
|
Question of the Day |
Today's question (by BTylerWhite): | |
Difference Between Lists | |
I have the following two lists in Python: registered_ids = [1, 2, 5, 7, 8, 9, 20, 21, 22] recent_login_ids = [3, 5, 9, 21]Comparing these two lists, how can I return a list of registered_ids not present in our list of recent_login_ids? | |
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) |
The ordering of the data I have this code: DECLARE @Test TABLE (testString VARCHAR(1) COLLATE SQL_Latin1_General_CP1_CS_AS); INSERT INTO @Test (testString) VALUES ('a') , ('b') , ('c') , ('A') , ('B') , ('C'); Then I run this in the same batch. SELECT testString FROM @Test WHERE testString LIKE '[a-B]'; What is returned (each letter in the answer would be on a separate row)? Answer: a, B Explanation: This is an interesting collation issue. The ordering of the entire set, given the collation, is: A a B b C c In this case, the return is a, B. |
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 |
SSIS Deployment Issue - Hello: Problem: Cannot deploy SSIS packages to AZURE VM/SQL Server Instance (or execute them via SSDT/VS) from a local laptop using a SQL Login. FYI: Project Deployment Model is used. Background: We moved our development SQL Server instance to an AZURE VM, and would like to avoid giving every developer RDP permissions access to the server. […] |
query optimization - |
SQL Server 2017 - Development |
count by week by start/end date - I'm trying to show a count by week but I am unsure of how to find dates between years? How do I show the Year, Week, and count for the example below? This ID_NUM should show 1 for every week for the entire year. I've shown what I've tried so far below. Thanks. I'd […] |
update by quantity - I'm writing an update statement that uses a quantity column to determine how many rows get updated. I can accomplish this using RBAR, but performance is unusable and I can't figure out how to do this as a set operation. I have a sales table that contains a row for each individual item. In the […] |
SQL Server 2016 - Administration |
Convert SQL HA (2 node) to Standalone - Hi, We have some of the SQL Server AlwaysOn environment (NonPROD) where we do not require alwayson any longer. Instead a standalone system will be sufficient. Without provisioning a new environment (standalone), how we can use the existing HA to a standalone and remove one of the other nodes? Does Microsoft has any clearly defined […] |
Shrinking _log file for live database - I have a live database in SQL2016 (in Production, in use) that I need to shrink its l_log file which has grown to over 250GB. Can I use this type of command block safely?: ALTER DATABASE ExampleDB SET RECOVERY SIMPLE DBCC SHRINKFILE('ExampleDB_log', 0, TRUNCATEONLY) ALTER DATABASE ExampleDB SET RECOVERY FULL |
Logical file name mismatch - Hi All I've picked up that the logical name for my transaction log is different between sys.database_files and sys.master_files. I know how to fix this up. My question is, how did it get that way? How can I recreate this issue? SQL Server 2016 Thanks |
SSRS report font settings - Dear team, Hope all are safe and doing well, We have a Windows Server 2016 STD server with SSRS installed. Question is where can I download Arial Narrow & Myriad Pro To use in SSRS reports? Is this available on Windows server 2016? User is having some issues with fonts while exporting reports to PDF on our […] |
SQL Server 2016 - Development and T-SQL |
Stored Proc slow after switching to Replication? - Hi First, let me apologize in advance for my ignorance on this... We are in the process of switching our reporting DB from backup and restore to transactional replication. I am testing stored procedures and noticing some SP's run much slower in transactional replication. I've done some googling and have tried the three below, but […] |
Development - SQL Server 2014 |
Trouble with Finding Dependencies between Tables using Keys - In the past I could rely on the View Dependencies feature in SQL Server Mgt Studio to show me all objects that an Object depends on or that the object is dependent on. I don't know when this changed but it no longer works reliably. The View Dependencies works for some parent/Child tables but not […] |
How to find Last Record with multiple results - In Access, there is a LAST function, which simply allows you to do a group by, then select last, and you get the last record for each of your results. This does not exist in SQL. I have a query I am running that will show me a full list of all Part ID's in […] |
SQL Server 2012 - T-SQL |
Finding a range of date within a range of date - I have a project that requires to display a list of patients within a specific period of dates but having problems building my statement the following is the sample data set. CaseNo DateAdmitted DateDischarge 1 12/01/2019 12/02/2019 2 12/01/2019 12/03/2019 3 12/02/2019 NULL - not yet discharge Scenario 1: getting patients from 12/02/2019 to 12/03/2019 […] |
SQL Server 2019 - Administration |
Unexcpted erorrs restoring large tables - Hi Please excuse me if this is a basic question, I have been given a .sql file which has a script to create and insert data into a table. The script around 100,000 records in it. Most of the content is in the form 'Insert into table ....' 'insert into table ...' GO Insert into […] |
SQL Server 2019 - Development |
Arithmetic overflow error converting expression to data type nvarchar. - Is there a way to find the field this error is being generated by? I am trying to bring data from an AS400 to SQL. I am attempting to convert 3 fields to date formats. I have a staging table that converts them to nvarchar(10) then when inserting into the final table I do IDATE(field) […] |
SQL Server Newbies |
Force job to fail based on condition of IF - I am using SQL Server 2005 and I need to force a job to fail based on a condition of an IF statement. This is an overview what my code is doing: IF (SELECT '1') = 1 BEGIN PRINT 'Yes' END ELSE BEGIN PRINT 'No' END The above isn't my exact code but this gives […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |