Viewing 15 posts - 1,246 through 1,260 (of 7,616 total)
You left off the parens (and something to separate the new SELECT from the old command, either a space or a semi-colon):
EXEC sp_executesql (@SQL + ';' + @SQL1)
September 29, 2021 at 7:09 pm
To determine proper clustering (PKs) for the tables, we'd need to know more about how the data is most often processed, by statistics type or entityid or timeperiod range.
However, as...
September 29, 2021 at 3:40 pm
Create the temp table before calling the proc. Have a flag that is passed in to "tell" the proc to load its results into the temp table, or you could...
September 28, 2021 at 3:34 am
sql playing dumb on this case
if your software can be set to do other types of joins/cross applies or even to, as you said, generate the isnull (which works...
September 27, 2021 at 3:20 pm
Not one of these are valid date/datetime values:
'Sep 01', '2001-Q3', '2001-Q2', 'Sep 01', '2001-Q3', '2001-Q2'
September 26, 2021 at 10:22 pm
Whoever's teaching your class is not particularly expert at db design. Storing NNN-NNN-NNN is just plain wrong; it's a waste of space to store fixed dashes in a column.
September 26, 2021 at 10:17 pm
Gotta say this, since it's a pet peeve of mine = Using comments in place of accurate names.
Viz, why?:
FROM Tally t --Month count sequence starting at 0
rather than:
FROM Tally month_count...
September 24, 2021 at 7:43 pm
Hi Scott,
like I mentioned earlier, the WHERE clause is added afterwards in my application (so the user can choose to see archived corporations only, active corporations only or both)....
September 24, 2021 at 7:39 pm
Yeah, you can test for NULLs in columns and/or GROUPING_ID to determine: which rows are total rows and which rows are detail rows; to exclude total rows you don't want;...
September 24, 2021 at 6:09 pm
Actually, if you want to comprehensively review the indexes on those table, run this script twice (once for 'Corporation%' tables and once for 'Entity%' tables) and post both result sets...
September 24, 2021 at 6:03 pm
You should be able to script this out. Make sure the "Script indexes" option is on. Then Script the table; that should give you DDL for the table and all...
September 24, 2021 at 5:57 pm
OK. You said "instead of" so I figured you didn't want the other details in the new query.
Maybe try:
GROUP BY entity,groupname,description,effdate WITH ROLLUP
You can get rid of total lines you...
September 24, 2021 at 5:55 pm
Not 100% sure what you need, but probably:
SELECT entity
,description
,[Total] =...
September 24, 2021 at 5:32 pm
Do you have an index on:
CorporationHistory ( CorporationID, EffectiveDate )?
If not, you need one.
I specialize in tuning SQL Server. It's easy to overlook indexes if you don't have a lot...
September 24, 2021 at 5:23 pm
Viewing 15 posts - 1,246 through 1,260 (of 7,616 total)