Skip to content

Instantly share code, notes, and snippets.

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<style type="text/css">
.dragging {background-color: blue}
</style>
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
SELECT [JobTitle]
FROM [AdventureWorks2012].[HumanResources].[Employee]
SELECT DISTINCT [JobTitle], Gender
FROM [AdventureWorks2012].[HumanResources].[Employee]
SELECT VacationHours + SickLeaveHours as daysOff, JobTitle,VacationHours, SickLeaveHours
FROM [AdventureWorks2012].[HumanResources].[Employee]
*******************************************************************
-- INLINE CALCULATIONS
SELECT VacationHours + SickLeaveHours as daysOff, JobTitle,VacationHours, SickLeaveHours
FROM [AdventureWorks2012].[HumanResources].[Employee]
SELECT [CommissionPct] ,[SalesYTD], ([SalesYTD]/100)*[CommissionPct] as commission
FROM [AdventureWorks2012].[Sales].[SalesPerson]
@cflove
cflove / sql3.sql
Last active August 29, 2015 14:00
sql-3
SELECT AVG(ListPrice) , MIN(ListPrice), max(ListPrice),
sum(ListPrice), count(ListPrice), COUNT_BIG(ListPrice), color
FROM Production.Product
group by color
SELECT AVG(ListPrice) , MIN(ListPrice), max(ListPrice),
sum(ListPrice), count(ListPrice) as c, COUNT_BIG(ListPrice), color
FROM Production.Product
group by color
@cflove
cflove / sql-test.sql
Last active August 29, 2015 14:01
sql-test
--CREATE TABLE #MyTable (EventNname varchar(20), EventDate date, PublishedDate date)
INSERT INTO #MyTable
SELECT 'Bake Sale', '1/1/2014','1/1/2014' UNION ALL
SELECT 'Movie Night', '1/2/2014','1/2/2014' UNION ALL
SELECT 'Dance Night', '1/3/2014','1/2/2014' UNION ALL
SELECT 'Flea Market', '1/4/2014','1/3/2014' UNION ALL
SELECT 'Dance Night', '1/5/2014','1/3/2014' UNION ALL
SELECT 'Marathon', '1/6/2014','1/3/2014' UNION ALL
SELECT 'Daance', '1/3/2014','1/2/2014'
create table #DailyIncome(VendorId nvarchar(10), IncomeDay nvarchar(10), IncomeAmount int)
insert into #DailyIncome values ('SPIKE', 'FRI', 100)
insert into #DailyIncome values ('SPIKE', 'MON', 300)
insert into #DailyIncome values ('FREDS', 'SUN', 400)
insert into #DailyIncome values ('SPIKE', 'WED', 500)
insert into #DailyIncome values ('SPIKE', 'TUE', 200)
insert into #DailyIncome values ('JOHNS', 'WED', 900)
insert into #DailyIncome values ('SPIKE', 'FRI', 100)
insert into #DailyIncome values ('JOHNS', 'MON', 300)
insert into #DailyIncome values ('SPIKE', 'SUN', 400)
@cflove
cflove / ssl
Created October 30, 2014 17:51
covert pfx from cft and key
openssl pkcs12 -export -out domain.name.pfx -inkey domain.name.key -in domain.name.crt
@cflove
cflove / test.cfm
Last active August 29, 2015 14:08
Railo Cookie Test
<cfif not structKeyExists(cookie,'Bingo')>
<cfcookie secure="false" httpOnly="true" name="Bingo" value="" />
Cookie Created with an empty value. Refresh the Browser to confirm.
<cfelse>
Cookie Exists. All good.
</cfif>
@cflove
cflove / Railo-PDF.cfc
Created November 21, 2014 15:34
Fetch list of columns and their values for Railo CFM. Not complete, just enough functionality for my current use.
<cfcomponent displayname = "PDFTools" output= "Yes" accessors="true" >
<cfproperty name="file">
<cfproperty name="map">
<cffunction name = "init" access = "Public" output = "No" returntype = "Any">
<cfargument name = "filePath" required= "Yes" type = "String" default = "" />
<cfset local.p = createObject("java",'org.apache.pdfbox.pdmodel.PDDocument') />
<cfset COSName = createObject("java",'org.apache.pdfbox.cos.COSName') />
<cfset setFile( local.p.load( arguments.filePath ) )/>
select EmailAddress from [Person].[EmailAddress]
where [BusinessEntityID] =
(
SELECT [BusinessEntityID]
FROM [Person].[Person]
where FirstName = 'Ken'
and LastName = 'Kwok'
)
----------------------------------------
select EmailAddress from [Person].[EmailAddress]