Viewing 15 posts - 3,481 through 3,495 (of 7,609 total)
I don't really see the need for the overhead and potential issues of reading the sys.all_columns view.
;WITH
cteTally10 AS (
SELECT * FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0))...
March 22, 2018 at 10:48 am
SELECT FieldName,
MAX(CASE WHEN ID = 2 THEN RecordCount END) AS OldCount,
MAX(CASE WHEN ID = 1 THEN RecordCount END) AS NewCount,
MAX(CASE WHEN...
March 21, 2018 at 2:30 pm
Prob not "the best way", but I think it works:
select ssalesid, salesname, salesamount_split, rank
from (
select 1 as ssalesid, 'cust1' as salesname, cast(101.50...
March 20, 2018 at 11:04 am
March 20, 2018 at 10:17 am
Are they covering indexes? Just having a nonclustered index on a joining column(s) is often not useful for SQL, unless that index fully covers the query.
I have had...
March 20, 2018 at 10:07 am
I prefer to use CROSS APPLY to assign an alias name, like below. Just to show the capability, I also used a CROSS APPLY to get the CONCAT'd column value:...
March 20, 2018 at 9:57 am
If the app is going to be reading the entire table anyway, if possible, use a clustered columnstore index.
March 20, 2018 at 8:19 am
Interesting article which brought up a great point about things to consider when writing code.
But you need to be fair to the "combined" code version. So let me...
March 20, 2018 at 8:12 am
If you want blanks rather than NULL, then:
CASE WHEN ALTotalUnits / TotalProfiledHours >= 3 THEN CAST(ALTotalUnits AS varchar(30)) ELSE '' END AS [Higher than 3 Weeks],
CASE WHEN...
March 20, 2018 at 7:40 am
Any WHERE conditions in particular. Typically StartTime is (almost) always compared against log-type tables. And/or the data is summarized by StartTime periods (day, week, etc.). If so, cluster the table...
March 19, 2018 at 2:26 pm
CASE WHEN ALTotalUnits / TotalProfiledHours >= 3 THEN <higher than 3 weeks>
CASE WHEN ALTotalUnits / TotalProfiledHours < 3 THEN <lower than 3 weeks>
March 19, 2018 at 2:20 pm
Alter the schema on those tables/views to 'dbo', then you should be able to view them just fine.
If it doesn't allow that, you'd have to script them out,...
March 19, 2018 at 1:37 pm
Yeah, STUFF is good stuff!
Another thing to note is that you need to STUFF from right to left. Otherwise the stuffed chars throw off the byte locations.
March 19, 2018 at 12:35 pm
If you're literally using "*" in the view, refreshing the view is often needed too. Not sure if that works for remote tables, but presumably it would (or SQL would...
March 16, 2018 at 3:33 pm
Viewing 15 posts - 3,481 through 3,495 (of 7,609 total)