Skip to content

Instantly share code, notes, and snippets.

View BDollar's full-sized avatar

Brandon Dollar BDollar

  • Cartersville, Ga
View GitHub Profile
@BDollar
BDollar / viewCommonDates
Last active March 16, 2018 14:22
This is a SQL view that maintains important generic dates for use in servers that do not have date-handling features (AS400 JD Edwards).
USE [master]
GO
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[viewCommonDates]'))
DROP VIEW [dbo].[viewCommonDates]
GO
USE [master]
GO
@BDollar
BDollar / Excel_SubdivideAndVLookup
Created May 29, 2013 12:45
Excel formula for subdividing a string in a cell and looking up the sections of the string in other worksheets.
'ItemNumber', 'Prefix' and 'Suffix' are named ranges.
=LEFT(C37,SEARCH(",",C37,1))&" "&VLOOKUP(LEFT(B37,SEARCH("-",B37,1)-1),Prefix,2,FALSE)&" x "&VLOOKUP(MID(B37,SEARCH("-",B37,1)+1,100),Suffix,2,FALSE)&" / "&VLOOKUP(LEFT(B37,SEARCH("-",B37,1)-1),Prefix,3,FALSE)&" x "&VLOOKUP(MID(B37,SEARCH("-",B37,1)+1,100),Suffix,3,FALSE)
=LEFT(C37,SEARCH(",",C37,1))&" "&VLOOKUP(LEFT(B37,SEARCH("-",B37,1)-1),Prefix,2,FALSE)&" x "&VLOOKUP(MID(B37,SEARCH("-",B37,1)+1,100),Suffix,2,FALSE)&" / "&VLOOKUP(LEFT(B37,SEARCH("-",B37,1)-1),Prefix,3,FALSE)&" x "&VLOOKUP(MID(B37,SEARCH("-",B37,1)+1,100),Suffix,3,FALSE)
=C366&" "&VLOOKUP(LEFT(MID(ItemNumber,SEARCH("-",ItemNumber)+1,100),SEARCH("-",MID(ItemNumber,SEARCH("-",ItemNumber)+1,100))-1),Prefix,2,FALSE)&" x "&VLOOKUP(MID(MID(ItemNumber,SEARCH("-",ItemNumber)+1,100),SEARCH("-",MID(ItemNumber,SEARCH("-",ItemNumber)+1,100))+1,100),Suffix,2,FALSE)&" / "&VLOOKUP(LEFT(MID(ItemNumber,SEARCH("-",ItemNumber)+1,100),SEARCH("-",MID(ItemNumber,SEARCH("-",ItemNumber)+1,100))-1),Prefix,3,F
@BDollar
BDollar / viewCommonDates
Created April 30, 2013 16:18
View that generates commonly used dates for SQL environments.
USE [master]
GO
/****** Object: View [dbo].[viewCommonDates] Script Date: 04/30/2013 12:14:20 ******/
IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[viewCommonDates]'))
DROP VIEW [dbo].[viewCommonDates]
GO
USE [master]
GO
@BDollar
BDollar / Powershell WMI Inventory A
Created April 24, 2013 20:01
MS Powershell - Using WMI to create a computer inventory
# ==============================================================================================
#
# Microsoft PowerShell Source File -- Created with SAPIEN Technologies PrimalScript 2007
#
# NAME: Server/Workstation Inventory (CompInv_v2.ps1)
#
# AUTHOR: Jesse Hamrick
# DATE : 2/25/2009
# Web : www.PowerShellPro.com
# COMMENT: Script Inventories Computers and sends results to an excel file.
@BDollar
BDollar / Scheduler_FTPUpload
Created April 10, 2013 18:09
Using Scheduler to Upload to an FTP
I recently came across a problem where I needed to schedule the daily FTP upload of a set of files to one of my client’s FTP servers. I was a bit out of my element and found that locating a solution to this task was surprisingly challenging. I thought I would post the steps here so that someone in a similar situation might benefit from the time I spent in trial and error.
1. My first goal was to make sure I could upload via ftp using the command prompt in Windows XP. I created the following script, ftp_script.txt, which I placed in a scripts folder on the C drive:
open www.yourhostname.com
username
password
put c:\test.txt test.txt
quit
@BDollar
BDollar / Command_SQLCMD
Created April 10, 2013 16:20
Microsoft (R) SQL Server Command Line Tool - Use the command line to issue SQL commands
sqlcmd -S myServer
-D myDB
-E
-O "MyData.txt" ^
-Q "select bar from foo" ^
-W 999
-S ","
sqlcmd /?
Microsoft (R) SQL Server Command Line Tool
@BDollar
BDollar / SQL_ExportToExcel
Created April 10, 2013 15:47
SQL Stored Procedure - Excel File Creation
USE [database]
GO
/****** Object: StoredProcedure [dbo].[prcExport_DailyReport] Script Date: 04/10/2013 11:54:26 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[prcExport_DailyReport]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[prcExport_DailyReport]
GO
USE [database]
GO
@BDollar
BDollar / CrystalReports_DoubleCheckboxIncludes
Created April 9, 2013 16:31
Crystal Reports - Select Expert Record - Double checkbox filter: This is an example of using two different checkboxes as flags to include.
(
({BAQReportParameter.Check02}=TRUE)
OR
({BAQReportResult.ProdGrup.Description}<>"Raw Materials")
) and
(
({BAQReportParameter.Check01}=TRUE)
OR
(
{BAQReportResult.Part.PartNum}<>""