Viewing 15 posts - 31 through 45 (of 380 total)
I forgot to include the expected results. Sorry about that. Here you go:

June 23, 2025 at 11:27 pm
I think this is what you are looking for.
-- For each test_date, determine the last date to count in a 10 date range
; WITH DateAnalysis AS
(SELECT...
June 23, 2025 at 11:07 pm
Got data? What if you use OUTER/CROSS APPLY to retrieve the top N records? Prove it doesn't work. Provide some data.
My SQL skills are not too sharp. I am...
June 19, 2025 at 7:04 pm
Got data? What if you use OUTER/CROSS APPLY to retrieve the top N records? Prove it doesn't work. Provide some data.
np. here you go:
drop table if...
June 19, 2025 at 7:02 pm
Can you not insert a rolling 10 days window? Something along the lines of
PERCENT_RANK() OVER (PARTITION BY year ORDER BY date DESC ROWS BETWEEN 10 PRECEDING...
June 19, 2025 at 3:27 pm
ensure the file is a correctly built CSV file - if it is then you can load it using the format=CSV above - if it not then...
June 10, 2025 at 4:23 am
ensure the file is a correctly built CSV file - if it is then you can load it using the format=CSV above - if it not then get whoever...
June 9, 2025 at 3:42 pm
What if you change MAXERRORS = 0 to MAXERRORS = 1 (or whatever your upper limit is)
I tried a few values and the outcome is the same. The file...
June 9, 2025 at 3:36 pm
I came across OPENROWSET. This looks promising but I have never used it before. Can this be used for my purpose? If yes, how would I use it? I am...
June 8, 2025 at 11:15 pm
There is probably a non-printable character in it.
CREATE TABLE #DIVIDENDS_NEW
(
[DIVIDEND_AMOUNT] [varchar](15) NULL
);
insert into #DIVIDENDS_NEW select NULL;
insert into #DIVIDENDS_NEW select '5';
insert into #DIVIDENDS_NEW select CHAR(10); /* invisible...
June 5, 2025 at 3:35 pm
This is great. It works. Thank you so much!
June 4, 2025 at 11:45 pm
I re-wrote my code with an IF statement and that solved the issue.
June 2, 2025 at 4:43 am
Try/Catch blocks? https://learn.microsoft.com/en-us/sql/t-sql/language-elements/try-catch-transact-sql?view=sql-server-ver16
I clarified my original post. Not sure if you saw it or not when you replied.
I did think about TRY/CATCH but not really sure how I can...
May 24, 2025 at 4:28 am
I gave the proposed logic CASE but I am open to anything. If code has an error then return NULL else run the code
May 24, 2025 at 4:20 am
I was playing around with the query. I figured out the problem. The query didn't like the alias. Once I removed the alias then it worked. That is so odd...
May 1, 2025 at 3:26 am
Viewing 15 posts - 31 through 45 (of 380 total)