This question already has answers here:
How to check any missing number from a series of numbers?
(11 answers)
SQL - Find missing int values in mostly ordered sequential series
(6 answers)
Closed 5 years ago.
I have a number sequence field in a table that has some gaps/skipped numbers in it. I need to identify the skipped numbers. The only solution I can think of is to use iterative/cursor based loops and I suspect that will be fairly slow. Is there a faster method?
Related
This question already has an answer here:
CONV() function in snowflake
(1 answer)
Closed 2 years ago.
Trying to convert two or three columns in a huge table from base 36 to base 10.
I know the python code for it. But looking to do it in SQL (Snowflake). Is there a better way?
I wrote a JavaScript UDF to convert from any base to another base. Just call CONV(x, 36, 10) to go from base 36 to base 10.
CONV() function in snowflake
This question already has answers here:
T-SQL dynamic pivot
(5 answers)
Why is processing a sorted array faster than processing an unsorted array?
(26 answers)
Closed 4 years ago.
I have spent an hour already on this problem.
I want to dynamically generate columns based on the values from the column AttendanceDate.
I have found some similar questions, but unfortunately the examples were too complicated for me to comprehend.
Data:
Expected output:
This can be done with the stuff method as mention in comments or with a while exists implementation:
http://rextester.com/FPU47008
This question already has an answer here:
SQL Fuzzy Matching
(1 answer)
Closed 6 years ago.
attempting to match a list of names that are similar in one very long column to another that are close but often vary do to missing letters and punctuation? is there a simple solution via a macro and/or sql?
using Levenstein functions can help
check the function and algorithm here: Levenshtein distance in T-SQL
after you create a function - compare the distance, for example:
select ..... from....
where dbo.Levenstein(str1,str2)>0.9 --means, the match between str1 and str2 is 90%
This question already has answers here:
Difference of two date time in sql server
(21 answers)
Closed 7 years ago.
I have 2 dates: startDate= 6/22/2015 and endDate= 6/20/2015.
I need to decrement these 2 dates, i meen endDate-startDate, so in this example I will get 2.
How can I do this in sql?
The native way to do this would be to use the setDate method. There is an existing Stackoverflow post here: How to Add Dates
However, I always pass along the advice to use a date library, something like moment.js. In most languages, managing dates (timezones, leap years, etc ets) is incredibly difficult, and javascript can be even more so with browser time zone behaviors.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Split Function equivalent in tsql?
I have a column that contains data in the form:
CustomerZip::12345||AccountId::1111111||s_Is_Advertiser::True||ManagedBy::3000||CustomerID::5555555||
Does SQL have any sort of built in function to easily parse out this data, or will I have to build my own complicated mess of patindex/substring functions to pull each value into its own field?
I don't believe there is anything built in. Look at the comments posted against your original question.
If this is something you're going to need on a regular basis, consider writing a view.