This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Misc good to have commands when using git | |
# | |
# Short and nice log | |
git log --pretty=oneline Path | |
# Create a new freestanding branch | |
git symbolic-ref HEAD refs/heads/<branch-name> | |
rm .git/index -ErrorAction SilentlyContinue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Misc good to have commands when using git | |
# | |
# Short and nice log | |
git log --pretty=oneline Path | |
# Create a new freestanding branch | |
git symbolic-ref HEAD refs/heads/<branch-name> | |
rm .git/index -ErrorAction SilentlyContinue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT s.name, o.name, o.type, o.type_desc, s.schema_id | |
FROM sys.objects AS o | |
INNER JOIN sys.schemas AS s ON o.schema_id = s.schema_id | |
WHERE s.name NOT IN ( 'dbo', 'sys' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Remove non dbo tables, views and stored procedures | |
-- | |
BEGIN TRANSACTION | |
DECLARE @Cmd NVARCHAR(max); | |
DECLARE [CmdCursor] CURSOR FAST_FORWARD READ_ONLY FOR | |
SELECT 'DROP TABLE [' + s.name + '].[' + t.name + '];' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Select the tables, views and stored procedures that are not in the [dbo] schema | |
-- | |
-- Useful when double checking that prople has not run scripts with the wrong user | |
-- for databases that have everything in the [dbo] schema. | |
-- | |
SELECT 'Table' AS [Type] , | |
'[' + s.name + '].[' + t.name + ']' AS [Name] | |
FROM sys.tables AS t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Count rows in all tables, display tables with rows | |
-- | |
CREATE TABLE #T ( | |
name NVARCHAR(255), | |
[rows] INT, | |
reserved NVARCHAR(255), | |
data NVARCHAR(255), | |
index_size NVARCHAR(255), |