Viewing 15 posts - 16 through 30 (of 13,408 total)
i see your strategy, simply filter with a WHERE statement to process just the desired rows.
I suspect you just need a decent cursor model? here you go!
December 20, 2020 at 1:13 pm
To leverage the Alias, I think you would need to either use a common Table Expression or a sub query to expose the alias to the next statements.
Alais's are evaluated...
December 20, 2020 at 12:44 pm
I think what you want to do is to use a CASE statement to evaluate the b.score: if it's less than zero use zero, else use the b.score
December 20, 2020 at 12:38 pm
December 20, 2020 at 12:38 pm
I cannot think of something out of the box that does this, third part or not.
i think you have to do this manually, and it will be a bit of...
December 8, 2020 at 9:04 pm
if the database is in SIMPLE recovery mode, it goes back to whether the database is currently accessible or not.
you could restore last nights backup as a new database name,...
September 9, 2020 at 10:29 am
so SQL server has a lock on the mdf/ndf/ldf files because they are in use, so are you really, really sure the mdf was encrypted?
is the database currently up and...
September 9, 2020 at 10:26 am
no help for the specific error, but structure wise, here's some help.
If you are using SUM,MIN,MAX,AVG you need a GROUP BY statement, and a column to group by.
All columns in...
September 9, 2020 at 10:14 am
i think sp_helprev_login has been the go to solution for years for logins.
database permissions are stored in the databases themselves, and those are scriptable from SSMS , and if you...
August 4, 2020 at 7:09 pm
well, for items that are not in index stats at all, you could use something like this:
SELECT name FROM sys.[databases] WHERE [database_id] NOT IN(SELECT database_id FROM [sys].[dm_db_index_usage_stats]...
August 4, 2020 at 6:57 pm
in order to keep things ATOMic, nolock is ignored in INSERT/UPDATE/DELETE operations.
even if you added it, it would be ignored.
August 4, 2020 at 10:22 am
Well for MaxDop recommendations, I've been using this pair of scripts which have calculations that someone else came up with.
this script takes into account numa nodes and microsofts recommendations, and...
August 1, 2020 at 2:08 am
multi-threading is completely unrelated to how SQL server internally uses multiple cores.
a multi threaded operation is how the applciation does it's thing, SQL server is a black box as far...
July 31, 2020 at 5:41 pm
sys.dm_db_index_usage_stats already has all the index usage for all databases and all tables inside it, so you can get all the Databases all at once. no need for a loop...
July 31, 2020 at 2:00 am
you would need to add some code to specifically stop execution in the loop if an error is encountered.
you might want to change the logic to be all-or-nothing, instead of...
July 30, 2020 at 1:29 pm
it looks to me like you declare one variable, but use one that never existed a few lines later:
i think you declared "SQL", but dynamically create "strSQL" a few lines...
July 24, 2020 at 7:26 pm