Skip to content

Instantly share code, notes, and snippets.

View JustinMcNamara74's full-sized avatar

Justin McNamara JustinMcNamara74

View GitHub Profile
@JustinMcNamara74
JustinMcNamara74 / netezza_course_notes.md
Last active November 8, 2021 13:47
IBM Puredata Usage/Admin Course Notes

Netezza Course Notes

Usage Course

Possible Issues

  1. If you see "connection refused" do the following:
  • Log in using nz creds
  • Type nzstate to see if the connection is stopped
  • If it is stopped, enter nzstart
  • Log back into student account, and try accessing the nzsql again
@JustinMcNamara74
JustinMcNamara74 / #MSSQL script_logins.sql
Created June 16, 2016 18:30
Scripts out windows/sql logins for all users
USE [master]
GO
/****** Object: UserDefinedFunction [dbo].[fn_hexadecimal]
Credit - http://weblogs.sqlteam.com/billg/archive/2010/07/08/Scripting-out-SQL-Server-Logins.aspx
****/
SET ANSI_NULLS ON
GO
@JustinMcNamara74
JustinMcNamara74 / #NVM revert-node
Created May 2, 2016 15:00
Revert node 6.0 to earlier version, and install all componenets
nvm install 5.*
nvm uninstall 6.*
npm install -g grunt-cli bower yo generator-karma generator-angular
@JustinMcNamara74
JustinMcNamara74 / find_db_triggers.sql
Created August 11, 2015 15:56
#MSSQL Find all database triggers
-- Find all triggers in a database
-- http://stackoverflow.com/questions/4305691/need-to-list-all-triggers-in-sql-server-database-with-table-name-and-tables-sch
SELECT
sysobjects.name AS trigger_name
,USER_NAME(sysobjects.uid) AS trigger_owner
,s.name AS table_schema
,OBJECT_NAME(parent_obj) AS table_name
,OBJECTPROPERTY( id, 'ExecIsUpdateTrigger') AS isupdate
,OBJECTPROPERTY( id, 'ExecIsDeleteTrigger') AS isdelete
@JustinMcNamara74
JustinMcNamara74 / find_table_name_like.sql
Created July 21, 2015 20:12
#MSSQL DB Search for table name like...
SELECT name
FROM Envision.sys.tables
WHERE name LIKE '%ucker%'; --Search for Tucker, Sucker, Pucker... what were you thinking?
@JustinMcNamara74
JustinMcNamara74 / find_table_indexes.sql
Created July 21, 2015 14:35
#MSSQL Find table indexes
SELECT * FROM sys.indexes
WHERE object_id = (SELECT object_id FROM sys.objects WHERE name = 'tableName')
@JustinMcNamara74
JustinMcNamara74 / enabled_jobs.sql
Last active August 29, 2015 14:20
#MSSQL List all enabled jobs
-- List all enabled jobs
USE [msdb]
select name
,description
,enabled
,job_id
,date_created
,date_modified
from dbo.sysjobs
where enabled = 1
@JustinMcNamara74
JustinMcNamara74 / MoveDB.sql
Created April 21, 2015 14:42
#MSSQL #DBA_TASK Move a database in SQL Server
/******************************************************************************
Task: Move a DB to another location
Resources: https://msdn.microsoft.com/en-us/library/ms345483.aspx
*******************************************************************************/
Use master;
GO
/** -------
Step 1
@JustinMcNamara74
JustinMcNamara74 / previous_weeks_backups.sql
Created April 8, 2015 13:41
#MSSQL Previous Weeks Backups
DECLARE @Gigs DECIMAL;
SET @Gigs = POWER(2,30);
-- http://www.mssqltips.com/sqlservertip/1601/script-to-retrieve-sql-server-database-backup-history-and-no-backups/
---------------------------------------------------------------------------------
--Database Backups for all databases For Previous Week
---------------------------------------------------------------------------------
SELECT
CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server,
@JustinMcNamara74
JustinMcNamara74 / CreateEncryptionKeyStructure.sql
Last active August 29, 2015 14:18
#MSSQL Creates all items necessary for SQL Server Encryption/Decryption
/**
A few notes:
- Remember the DB Master Key!!
- When creating certificates/keys be descriptive, as there may be many on your instance of SQL Server
**/
IF (select Count(*) from sys.symmetric_keys where name like '%DatabaseMasterKey%') = 0
BEGIN
CREATE master key Encryption by password = 'SomePassword';