This question already has answers here:
Using T-SQL, return nth delimited element from a string
(14 answers)
Split string and take last element
(15 answers)
Closed 2 months ago.
I have a string like this
0011.06.123.7-0
SELECT STRING_SPLIT(NUMBER,'.')
returns
Values
0011
06
123
And now I only and always need the third value, in this case '123'
How do I select this proberly?
I already tried to get the third value with the Rownumber, but that didn't worked out.
Related
This question already has answers here:
Find number deleted from array
(2 answers)
Closed 5 years ago.
I have two arrays a and b. a always has one element more than b, and the arrays are mixed.
a = [1,5,7,2,4]
b = [2,4,7,1]
I want to find the extra element in a. The output should be 5.
What is the best approach in ruby? Is it good idea to use loop?
I think this is the best built-in function to get what you expect
(a - b).pop
This question already has answers here:
SQL BETWEEN Operator conditional value in Reverse Order
(3 answers)
T-SQL BETWEEN problem max value first
(2 answers)
Closed 6 years ago.
Assume we have a table with an int column (primary key) and few other columns as well and above table contains data.
This query is working:
SELECT *
FROM Table
WHERE Id BETWEEN 1 AND 5
However, this query is not working:
SELECT *
FROM Table
WHERE Id BETWEEN 5 AND 1
I need an explanation why inverse not working when I swap operands. Please explain.
From the manual: "BETWEEN returns TRUE if the value of test_expression is greater than or equal to the value of begin_expression and less than or equal to the value of end_expression."
This question already has answers here:
How do I pick randomly from an array?
(7 answers)
Closed 7 years ago.
Select a element in the array randomly WITHOUT using the Random class.
id={1,2,3,4,5}
Is there any method which belongs to the Array class that is used to randomly select an element?
You can use the sample method
[:foo, :bar].sample # => :foo, or :bar :-)
Credit this SO question/answer
This question already has answers here:
How to check for Is Not Null in VBA?
(2 answers)
Closed 7 years ago.
While retrieving data from a database into an array one of my array elements is (or appears to be) 'Null', as the watch window shows.
However, pCurveDefinitions(2,0)=Null return FALSE.
How can I make the check in such a way it returns TRUE?
This is just a different test, like IsError, you should use IsNull(pCurveDefinitions(2,0))!
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Generating random strings with T-SQL
I need to generate a random string with alpha and numeric characters inside a trigger.
The string must have a length of 15 and uppercase.
Someone have an idea?
This is far from an optimal solution, but it will work as specified:
select char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)
+char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)
+char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)
+char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)
+char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)
Example output:
WCZOVRCIRELAJUT
generate a GUID and take just the first 15 characters?
Generate a bunch of random numbers and translate to their ASCII values?