If i'm on c:\Dog and want to move to d:\Cat then simply issuing the following command doesn't cut the mustard:
C:\Dog\cd d:\Cat
Instead, I need to issue it with the /D command
C:\Dog\cd /D d:\Cat

Beware. While I acknowledge that these people do exist, you need to check their motives. If they are doing so for personal gain then yes they are negative and are trying to "slow the bus down" for the wrong reasons. It may just be that they are trying to offer balance. Trying to apply the handbrake to stop the bus crashing off the cliff. But remember, if you mark yourself out as someone who is willing to challenge, you must be prepared to take criticism yourself as you'll be wrong often! And above all, never make it personal.
You need some brakemen and some accelerators so that you have a controlled efficient vehicle which can move forward at pace without losing control. Try a football analogy. Too many brakers and you have Arsenal - a good team without being great, just falling short perhaps as a result of not inveseting. Too many accelerators and you have Leeds, living the dream and crashing and burning.
it may be necessary to be a bit more cavalier to try and break some of the resistance to change. In a company where there is minimal control and change is virtually omnipresent, it is necessary to try and apply the brake and introduce process for the sake of stability. After all, while I love change- i also love stability and scalability.CREATE TABLE #T (i INT)
INSERT INTO #T SELECT 1
INSERT INTO #T SELECT 2
INSERT INTO #T SELECT 3
BEGIN TRAN
INSERT INTO #T SELECT 4
INSERT INTO #T SELECT 5
INSERT INTO #T SELECT 6
ROLLBACK TRAN
-- only 3 rows
SELECT * FROM #TDECLARE @t TABLE (i INT)
INSERT INTO @t SELECT 1
INSERT INTO @t SELECT 2
INSERT INTO @t SELECT 3
BEGIN TRAN
INSERT INTO @t SELECT 4
INSERT INTO @t SELECT 5
INSERT INTO @t SELECT 6
ROLLBACK TRAN
-- 6 rows!!
SELECT * FROM @t

-- set up our test dataset of all FIFA World Cup Winners
CREATE TABLE dbo.WorldCupWinners (Yr DATE, Winner NVARCHAR(255))
INSERT INTO dbo.WorldCupWinners VALUES ('19300101', 'Uruguay')
INSERT INTO dbo.WorldCupWinners VALUES ('19340101', 'Italy')
INSERT INTO dbo.WorldCupWinners VALUES ('19380101', 'Italy')
INSERT INTO dbo.WorldCupWinners VALUES ('19500101', 'Uruguay')
INSERT INTO dbo.WorldCupWinners VALUES ('19540101', 'Germany')
INSERT INTO dbo.WorldCupWinners VALUES ('19580101', 'Brazil')
INSERT INTO dbo.WorldCupWinners VALUES ('19620101', 'Brazil')
INSERT INTO dbo.WorldCupWinners VALUES ('19660101', 'England')
INSERT INTO dbo.WorldCupWinners VALUES ('19700101', 'Brazil')
INSERT INTO dbo.WorldCupWinners VALUES ('19740101', 'Germany')
INSERT INTO dbo.WorldCupWinners VALUES ('19780101', 'Argentina')
INSERT INTO dbo.WorldCupWinners VALUES ('19820101', 'Italy')
INSERT INTO dbo.WorldCupWinners VALUES ('19860101', 'Argentina')
INSERT INTO dbo.WorldCupWinners VALUES ('19900101', 'Germany')
INSERT INTO dbo.WorldCupWinners VALUES ('19940101', 'Brazil')
INSERT INTO dbo.WorldCupWinners VALUES ('19980101', 'France')
INSERT INTO dbo.WorldCupWinners VALUES ('20020101', 'Brazil')
INSERT INTO dbo.WorldCupWinners VALUES ('20060101', 'Italy')
INSERT INTO dbo.WorldCupWinners VALUES ('20100101', 'Spain');
-- we only want to get the distinct countries that have won
-- along with their first triumph which will be the FirstWin = 1
WITH wins
AS
(
SELECT *, ROW_NUMBER() OVER (PARTITION BY Winner ORDER BY Yr ASC) AS FirstWin
FROM dbo.WorldCupWinners
)
DELETE
FROM wins -- note how we're deleting from the CTE and NOT the base table
WHERE FirstWin > 1
GO
-- And hey presto, we have our desired output
SELECT *
FROM dbo.WorldCupWinners
/*
Yr Winner
1930-01-01 Uruguay
1934-01-01 Italy
1954-01-01 Germany
1958-01-01 Brazil
1966-01-01 England
1978-01-01 Argentina
1998-01-01 France
2010-01-01 Spain
*/
param($sqlserver)
$filePath = "C:\SQLScripts\Tables_" + $sqlserver + "_"
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-null
$srv = new-object "Microsoft.SqlServer.Management.Smo.Server" $sqlserver
$options = new-object "Microsoft.SqlServer.Management.Smo.ScriptingOptions"
$options.AppendToFile = $true
$options.ToFileOnly = $true
$options.ClusteredIndexes = $true
$options.NonClusteredIndexes = $true
$options.DriAll = $true
foreach($db in $srv.Databases | where {$_.IsSystemObject -eq $false})
{
$options.FileName = $filePath + $db.Name + ".sql"
$tables = $db.Tables
foreach($table in $tables | where {$_.IsSystemObject -eq $false})
{
$table.Script($options)
}
}/* add this crazy stuff in so i can use syntax highlighter