|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
ADF Triggers | |
As of March 2020, if I want to execute an Azure Data Factory pipeline with a trigger, what options do I have? | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (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? Answer: list(set(registered_ids).difference(set(recent_login_ids))) Explanation: We can use the built-in difference() function to accomplish this. First, our lists needed to converted to sets as we aren't able to identify differences without using list comprehension. Our result will need to be converted to a list to achieve the correct answer. This is similar to R's setdiff() function and SQL's EXCEPT set operator. Since we're able to use the "-" operand working with sets, the following code would also have been a viable answer. list(set(registered_ids) - set(recent_login_ids)) Reference: https://docs.python.org/3.9/library/stdtypes.html?highlight=difference#frozenset.difference |
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. […] |
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 |
SQL Server 2016 - Development and T-SQL |
Temporary turn off Transactional Replication? - Hi We get a DB that is replicated every 10 seconds or so We are having an speed issue running SP's against this database. Does anyone know of a command that I could temporary turn off Replication while the SP runs then turn it back on after the SP is completed? Thanks […] |
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 […] |
SQL Server 2012 - T-SQL |
Dynamic Column update. - I would like to update TASK_NXT_RUN_DT column based on the script in column 2 dynamically. I have tried using while loop and dynamic sql but no luck. Any help on this much appreciated create table #CFG_PROCESS_EVALUATE_TASK_MSTR ( taskid int, TASK_SCHED_SQL_SCRIPT varchar(500), TASK_LST_RUN_DT datetime, TASK_NXT_RUN_DT datetime ) insert into #CFG_PROCESS_EVALUATE_TASK_MSTR select 1,'dateadd(dd,1,TASK_NXT_RUN_DT)','2020-04-02 03:17:40.043', '2020-04-02 03:17:24.353' […] |
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 |
mass null replace in a query. - I have some data that i have no control over (third party supplying the data). I am extracting it to a CSV but the end user does not want "Null"s they want blank spaces is there a way to do a mass replace on all 36 fields. Case when isnull.... = ' ' end |
before update trigger on sql server - Hi everyone, I have two tables called users and formerpasswords. In users I have two fields: name which is primary key and password. In formerpasswords I have three fields: number which is primary key, name and password. I would like to create a trigger on users table so if I insert pairs of values in […] |
Integration Services |
continue my package even in Failure - Good morning all , I start in ssis and I have a request that I can't find a solution I have a 3 step package (Step1 ----> Step2 ---> Step3) I'm looking to go to Step 3 regardless of the status of step 2 (succed or Failed) Who can help me please on a solution? |
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 |