Viewing 15 posts - 1 through 15 (of 6,647 total)
You can create a query for Invoke-SqlCmd that accepts variables. See here: https://learn.microsoft.com/en-us/powershell/module/sqlserver/invoke-sqlcmd?view=sqlserver-ps
From that page:
$StringArray = "MYVAR1='String1'", "MYVAR2='String2'"
Invoke-Sqlcmd -Query "SELECT$(MYVAR1) AS Var1,
$(MYVAR2) AS Var2" -Variable $StringArray
Var1...
January 5, 2025 at 5:06 pm
You have total control over the process - so why can't you just pass into the query the LIKE statement and use that to get only the rows from the...
January 3, 2025 at 9:22 pm
Is there some reason you can't build a for-each loop in PS? I gave a basic outline for that - and it should be fairly easy to figure out from...
January 3, 2025 at 8:58 pm
Your question isn't clear - and the code to create @SINGLE_RETURN is really confusing. Why wrap a non-null CHAR(13) function with ISNULL to return an empty string when CHAR(13) will never...
December 31, 2024 at 9:37 pm
Several examples here: https://www.sqlservercentral.com/forums/topic/create-html-email
December 31, 2024 at 9:24 pm
Sure - depends on what you consider a 'hit'.
With that said - you have a lot of additional code here that isn't really needed. You can get rid of all...
December 31, 2024 at 9:18 pm
You should also be aware that the SELECT version will return the 'last' row from the result - however that last row is determined - whereas the SET version will...
December 30, 2024 at 5:52 pm
How are you determining 'unused table space'?
If this is actually unusable space allocated to the table - then it could possibly cause performance issues. If that is the case -...
December 24, 2024 at 9:06 pm
Instead of trying to convert the unix timestamp to a datetime2 - and then truncating that value down to the nearest minute, why not just round the timestamp itself to...
December 13, 2024 at 10:40 pm
Bad style of the query (I know, it is intended here, but you should never write it this way in real code).
Instead of
SELECT
c.CustomerName,...
November 6, 2024 at 7:43 pm
The full backup doesn't affect the transaction log - so you can just perform the 3pm log backup as normal and use that to restore to the 2pm point in...
November 1, 2024 at 9:44 pm
You have just learned a valuable lesson - scope does matter in SQL Server. Sub-queries have full access to the outer queries columns - so you can easily reference a...
October 31, 2024 at 8:37 pm
To answer your last question - no, you cannot restore to a point in time without having the full backup *prior* to the event and all transaction log backups from...
October 22, 2024 at 6:36 pm
That is SQL's method for handling insufficient space on a CAST.
I can see why CAST might do that (although I'd expect it to cause an error instead), but...
October 16, 2024 at 8:24 pm
Make sure you check the options on all pages. By default the GUI includes a tail log backup.
October 16, 2024 at 2:31 am
Viewing 15 posts - 1 through 15 (of 6,647 total)