Viewing 15 posts - 2,491 through 2,505 (of 7,608 total)
You'll want to add ERROR_MESSAGE() at least to your CATCH code. That will give you the specific error msg SQL issued. You should probably go ahead and add ERROR_LINE(), although...
February 13, 2020 at 6:07 pm
See if this works for you:
;WITH cte_raw_counts AS (
SELECT COUNT(*) AS total_company_count,
SUM(CASE WHEN rr.[company_name] =...
February 12, 2020 at 8:17 pm
I think it would be more accurate and far less work to rely on the existing constraints.
You should be able to use a BEGIN TRANSACTION and a TRY/CATCH block to...
February 12, 2020 at 3:42 pm
I'd do an explicit sp_recompile on all the tables affected by the renames, just to be safe. Renaming is great, but it's a short-cut method that's not fully "recognized" by...
February 10, 2020 at 10:29 pm
Out of interest - by 'later', are you saying that the CAST/ TRY_CAST is being executed in the SELECT before the WHERE?
That shouldn't be possible. Per Logical...
February 10, 2020 at 6:09 pm
I think creating a table and using EXCEPT / INTERSECT would perform better than a long string of ORs. Either would also take care of NULL values for you. So,...
February 10, 2020 at 6:07 pm
WHERE PS.popup_gid = 5 OR
(PS.popup_gid = 2 AND (T.record_Key_4 = '1' OR T.Record_Key_5 NOT IN ('I', 'X')))
February 7, 2020 at 4:12 pm
Just CAST() the column as a date, that gives you the most flexibility with the format of the column:
CONVERT(varchar(5), CAST(alertQueue.[Pickup_Date] AS date), 101) AS PickupDate
February 6, 2020 at 6:49 pm
Be sure to run the Data Migration Assistant on every user db. Don't assume one db is "just like" another one.
If the db is open and usable after it migrates,...
February 5, 2020 at 3:55 pm
Rats, I'd hoped it would work too.
If it's keyed lookups, the size of the underlying table won't matter, SQL would still do the lookup, I understand that.
February 4, 2020 at 5:46 pm
Here's the general structure. You can gen this out from the sys.columns table so you don't have to write out the code by hand.
SELECT
...
February 3, 2020 at 9:42 pm
Yes, there will be some limited page splits. But the reads against the table will be vastly more efficient, even with the splits.
It's certainly possible that [TimeDayId] then [Material_Werksdaten_key] would...
January 31, 2020 at 7:04 pm
Add an outer query, something like this:
SELECT *, [Gross_Revenue] - [Debits_and_Credits_Cost] AS NetRev
FROM (
SELECT Count(*) AS 'Count of Tranactions',
...
January 31, 2020 at 6:23 pm
You should cluster the table on:
( Material_Werksdaten_key, TimeDayId )
Your join is very confusing. You need to specify the TimeDayId(s) directly, not use a function on it.
Is TimeDayId one value per...
January 31, 2020 at 6:12 pm
select Id, CompletedDate, Code
from (
select *, row_number() over(partition by id order by completeddate desc) AS row_num
from #temp_dat1
) as...
January 30, 2020 at 10:55 pm
Viewing 15 posts - 2,491 through 2,505 (of 7,608 total)