Comments
Sort by recent activity
(I'm only a FoRG, not a Redgate employee.) The Error handling system in a SQL Compare script is there to prevent the script from carrying on after an error. Generally, you really shouldn't want it to carry on. The option removes this system in the scripts that catches those errors that do not otherwise automatically stop the batch or the entire script from being executed. The idea is to ensure that even an apparently trivial error rolls the script back. Unfortunately, some SQL Server errors can't be caught this way. The only way to prevent more serious errors, up to level 20 stopping the script is to use a try...catch block for every block or batch, but even then, you won't catch all errors, and I doubt whether it would have caught the one you had. . An object name resolution error is not caught by the TRY...CATCH construct. / comments
(I'm only a FoRG, not a Redgate employee.) The Error handling system in a SQL Compare script is there to prevent the script from carrying on after an error. Generally, you really shouldn't want it ...
I'll answer my own question about how to get a group. There is another Cmdlet called Get-SQLMonitorMainGroups that seems to do what I want. One then gets subgroups using Get-SqlMonitorSubGroups. I'm still mystified about what Get-SQLMonitorGroup does. / comments
I'll answer my own question about how to get a group. There is another Cmdlet called Get-SQLMonitorMainGroups that seems to do what I want. One then gets subgroups using Get-SqlMonitorSubGroups. I'...
This should do it. Sorry about the quotename stuff. I hardly ever seem to use columns with illegal characters in them. I meant to add something clever that added the quotes only when necessary but never got around to it. This should work nicely
/**
Summary: >
This is a temporary batch for creating such things as table variable,
temporary tables or anything else that needs a column list
Author: Phil Factor
**/
Declare @TheExpressionNVARCHAR(MAX)=
N'$SELECTEDTEXT$'
SELECT 'DECLARE @$NameOfVariable$ table ('+
Stuff ((SELECT ',
'+QuoteName(Coalesce(DetectDuplicateNames.name+'_'+Convert(VARCHAR(5),f.column_ordinal),f.name))
+ ' '+ System_type_name + CASE WHEN is_nullable = 0 THEN ' NOT' ELSE ''END+' NULL'
--+ CASE WHEN collation_name IS NULL THEN '' ELSE ' COLLATE '+collation_name END
AS ThePath
FROM sys.dm_exec_describe_first_result_set
(@TheExpression, NULL, 1)AS f
-- use sys.sp_describe_first_result_set for a batch
LEFT OUTER JOIN
(SELECT name AS name FROM sys.dm_exec_describe_first_result_set
(@TheExpression, NULL, 0) WHERE is_hidden=0
GROUP BY name HAVING Count(*)>1) AS DetectDuplicateNames
ON DetectDuplicateNames.name=f.name
WHERE f.is_hidden=0
ORDER BY column_ordinal
FOR XML PATH (''), TYPE).value('.', 'varchar(max)'),1,1,'')+')' / comments
This should do it. Sorry about the quotename stuff. I hardly ever seem to use columns with illegal characters in them. I meant to add something clever that added the quotes only when necessary but...
I've got a lot of SCA PowerShell scripts that I use that I can add. It would be a useful resource. I like the idea of the rollback scripts. / comments
I've got a lot of SCA PowerShell scripts that I use that I can add. It would be a useful resource. I like the idea of the rollback scripts.
I have a assigned a local windows user account to run the service. It looks from what you say, as if SQL Clone will only work if all the resources, SQL Server and network, are within a Windows Domain. Is that correct? / comments
I have a assigned a local windows user account to run the service. It looks from what you say, as if SQL Clone will only work if all the resources, SQL Server and network, are within a Windows Doma...
I get the formatter to work happily if I comment out the '--At WSLSource;' so I reckon the bug is there. It isn't your source which seems fine. I have put an entry in sys.servers for WSLSource to test this.
GO
CREATE TABLE tmpRptInvoiceHistory
(
BookingNo INT,
ReportDate DATETIME
);
GO
DECLARE @sql VARCHAR(MAX);
SELECT @sql = 'Select 1,''1 Jan 2008''';
INSERT INTO tmpRptInvoiceHistory(BookingNo, ReportDate) EXEC(@sql); --At WSLSource; / comments
I get the formatter to work happily if I comment out the '--At WSLSource;' so I reckon the bug is there. It isn't your source which seems fine. I have put an entry in sys.servers for WSLSource to ...
Yes, the problem is getting it in one file. If you are handy with PowerShell, you can automate the process to do several databases on one server in one go. I give a link to an article I wrote to show how to do several databases on one server. As far as I remember, it is possible to extend the code to do several servers but each server would be written to a different 'site'. I hope that wouldn't matter! https://www.red-gate.com/hub/product-learning/sql-doc/how-to-document-multiple-sql-server-databases-using-sql-doc-and-powershell / comments
Yes, the problem is getting it in one file. If you are handy with PowerShell, you can automate the process to do several databases on one server in one go. I give a link to an article I wrote to sh...