|
|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
A Scope Question | |
If I have this code, what is printed out?
temp = 10 def func(): global temp temp = 20 func() print(temp) | |
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 Number Subquery I have this data in a table: gapID ----- 1 2 3 4 6 7 8 10 14 15 16 17 If I run this code, what values are returned? SELECT gapID FROM gaps AS g1 WHERE NOT EXISTS (SELECT gapID FROM gaps AS g2 WHERE (g2.gapID = g1.gapID - 1)) ORDER BY gapID Answer: 1, 6, 10, 14 Explanation: This query finds the beginning of each contiguous sequence (or the beginning of each island). Ref: An Efficient Set-based Solution for Islands and Gaps - https://www.sqlservercentral.com/articles/an-efficient-set-based-solution-for-islands-and-gaps |
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 - Development |
Load a tabel using stored procedure. - Hello! I have a already created stored procedure named Membership which now is used to provide input for another application. Now the application is being replaced and I need to store the output of the procedure in a tabel in our database. The procedure gives me aggregated Member data (like in Year 2020, in the […] |
SQL Server 2016 - Administration |
Daily Autocheck for SQLInstances - [System.Data.Sql.SqlDataSourceEnumerator]::Instance.GetDataSources() | SELECT ServerName | Format-Table -HideTableHeaders The above code is not returning all instances within a domain. There is not a lot available here.https://docs.microsoft.com/en-us/dotnet/api/system.data.sql.sqldatasourceenumerator?view=netframework-4.8 Are there any prerequisites to be performed(on servers) for the above class to list all instances within a domain ? Thanks |
data file size difference - why is that when I run the sp_help (database name) or any query which gives datafile/log file name and size, it mentioned one value but when I go to the path where the data file is and check on property it gives another value I tried to restore the db but it still no change […] |
Administration - SQL Server 2014 |
RO-AG With Mirror On Different Compat Level - Good Morning Gentlemen, We have a 2014 SQL Server that is in a read only availability group with another 2014 sql server. We recently discovered that one of the databases on the primary is set for 2008 (100). We would like to update just the secondary database compatibility to 2014, I was wondering if anyone […] |
Development - SQL Server 2014 |
Conditional where clause - Hi , I wrote a stored proc where I need to evaluate a bit flag and if true append "NOT IN" clause. I don't want to use prepared statement. I tried following but it failed. Can I use Case or anyother statement to make it work ? table Test (id int, name varchar(10); table […] |
SQL Server 2019 - Administration |
Licensing question - Thinking of getting a perpetual standard licensing with certain number of cores. Was wondering what difference it makes it to get the standard licensing under software assurance. The perpetual should still be able to receive the cumulative updates and services packs, correct? Also, apart from memory and the cores cap on standard we should still […] |
Data Analization - Dear Forum, I would like to ask the following question: We have 50 excel tables. Each table has about 30 attributes. All tables together comprise around 1,2 Million rows. --> Is there a ready-to-use solution which would allow us to analyze this data? Thanks |
SSRS 2016 |
Fuzzy lookup gives error with nvarchar(max) - Hi guys I have an Excel source file and I want to do a fuzzy lookup, matching it to a column surname(nvarchar(max), null) in a table in the database. This database column in fuzzy lookup is a unicode text stream (DT_NTEXT). I place a data conversion between the Excel file and the fuzzy lookup and […] |
General |
Self-Joined to Find if Archived Versions of Record Exist w/o Duplicate Records - I have a table keeping client notes that can be updated and the previous note archived using an archived field. When a note is updated, the archived field is populated with the date on the old versions of the note. This allows us to see the current version (the one where archived is null) and […] |
Powershell |
Best way to automate password reset of sql account - I'm looking to have a timer job every 90 days that runs a ps script that resets a sql account password to meet security requirements. The idea is to auto generate a random strong password (i have this part working), then encrypt and store the password into a cryptex file, so other applications can use […] |
how to get directory contents to file - Hi all, I have a task that costs me a lot of time Maybe it is possible to automate this. I have a directory (Files) with a varying number of sub directories These subDirs are removed from time to time (back up), but I need to know what the filenames originally were. The dir looks […] |
Integration Services |
SSIS File System Task to move csv Files between folders - I am trying to add a File System Task to an existing package to move csv files from one folder to another on my local machine. I already have Connection Managers setup for both folders. When I try to configure the DestinationConnection and SourceConnection it tells me that "Type of connection" MyFolderName (i.e my source) […] |
Protection Level for SSIS Packages are missing - Hello Everyone I have SQL server 2019 with CU8 and Visual Studio 2019 I was given the packages from the data scientist and when i was looking at them i found that the Protection Level information was missing from the package properties window. Even the security section which holds the protection level is missing. Anyone […] |
PostgreSQL |
Search ALL tables for a String Value using DBeaver - Hi Forum, I'm usually a SQL Server coder & I've started using DBeaver to do a value search on a Data Hub. I've looked around but I can't find the logic to do this & then Loop it to return the Table & DB name. There are some answers, but they;re past my understanding of […] |
Resumes and Job Hunters |
Data/Database Career Options and Growth - I am a database professional who would like some feedback regarding some recent career choices I have made. At the beginning of the year, I became open to new opportunities and within the same week, had two job offers. One was a Database Developer role and the other was an ETL Developer. Although the Database […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |