Viewing 15 posts - 106 through 120 (of 1,244 total)
There's and even easier way...
To answer the original post (finding the matches, you can use the following...
SELECT
t1.*
FROM
#tblTest1 t1
CROSS APPLY ( VALUES (CHARINDEX('/', t1.SName)) ) dp (div_pos)
CROSS...
July 20, 2020 at 9:02 pm
This should give you the general idea...
DECLARE
@today date = '2020-07-16',
@beg_dt date,
@end_dt date;
SELECT
@beg_dt = CASE WHEN dt.cur_day < 16 THEN DATEFROMPARTS(dt.prev_year, dt.prev_month, 16) ELSE DATEFROMPARTS(dt.cur_year, dt.cur_month,...
July 17, 2020 at 3:29 pm
I have not tested this against any of the other solutions posted so far. It just looked like an interesting problem so I figured that I'd throw my hat into...
July 17, 2020 at 2:50 pm
Thanks all for your responses,
My question now is Why? Why does not works as is ? we are suggested to a very strict change control policy
Thanks
Why questions are...
July 14, 2020 at 12:38 pm
Yup, of course NULL does not equal NULL, but the fldinfo cannot be NULL (confirmed by OP).
So presumably @Parameter is optional and can be NULL. In which case...
July 14, 2020 at 11:32 am
In addition to Scott's good answer, you should also add "OPTION(RECOMPILE)" to the end of your statement in order to see the desired effect (a seek operation when a value...
July 13, 2020 at 2:26 pm
The reason I don't use that "bitter end date" is because I'll sometimes have code that adds a day, week, month, or quarter to an end date for purposes...
March 17, 2020 at 12:34 pm
p.s. This is also why I default EndTime columns to '9999', which is the same as 9999-01-01. It means that I don't have to have an OR in my...
March 16, 2020 at 8:35 pm
Here's an option that eliminates the need for a self join by using windowing functions (LAG & LEAD)
WITH
cte_overlap AS (
SELECT
e.EHRClientFK,
e.AdmDate,
e.DischDate,
Overlap = CASE
WHEN
e.AdmDate <...
February 24, 2020 at 3:33 pm
You should add the money data type to this - it shows that ISNUMERIC recognizes money formats and will convert those correctly.
I did. The 3rd value has a $...
February 4, 2020 at 11:29 pm
ISNUMERIC() doesn't do what you think it does. I think you'd be surprised by what all SQL Server considers "numeric".
SELECT
cv.char_val,
is_numeric = ISNUMERIC(cv.char_val),
is_int = TRY_CONVERT(INT, cv.char_val),
is_decimal =...
February 4, 2020 at 4:49 pm
Is there any way to apply a date range rather than the number of observations? I had this issue the other day, and had to revert to sub selects...
February 4, 2020 at 3:59 pm
Without something that ties the specific values together (eg "ABCD1234" belongs with "£133.00") then it's going to be a crap shoot as far as what values get paired up.
Based on...
January 21, 2020 at 5:07 pm
This is the script I use when I need to generate passwords...
SET NOCOUNT ON;
GO
DECLARE
@pw_len TINYINT = 12,
@enforce_number BIT = 1,
@enforce_upper BIT = 1,
@enforce_lower BIT = 1,
@enforce_special...
January 20, 2020 at 8:55 pm
This should put you in the ball park...
DECLARE
@Language char(1) = 'S',
@sql nvarchar(MAX) = N'';
SELECT
@sql = CONCAT(@sql, ', ', ISNULL(CASE WHEN @Language = 'E' THEN CONCAT(QUOTENAME(ISNULL(b.EnglishColumnName,...
January 16, 2020 at 7:19 pm
Viewing 15 posts - 106 through 120 (of 1,244 total)