This file contains hidden or 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
USE companydb | |
DECLARE @companyname_active TABLE | |
( | |
[Custom Label] VARCHAR(75) | |
,[Purchases] INT | |
,[Category Number] INT | |
,[Price] DECIMAL(6,2) | |
,[Item Title] VARCHAR(90) | |
) |
This file contains hidden or 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
# encoding=utf8 # This eliminates issues with Unicode errors that I was previously encountering. | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf8') | |
from ebaysdk.finding import Connection as Finding | |
import csv | |
"""The first function only finds a total page count. This func outputs the Page count, | |
and will be used as Range in the next Func.""" |
This file contains hidden or 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
n = [3, 5, 7] | |
def double_list(x): | |
for i in range(0, len(x)): | |
x[i] = x[i] * 2 | |
return x | |
print double_list(n) |
This file contains hidden or 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
# encoding=utf8 | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf8') |
This file contains hidden or 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
<% $row | |
.replace(/a dull boy/,'an axe-wielding maniac') | |
.replace(/an axe/,'a teddy bear') | |
.replace(/work/,'sex') | |
%> |
This file contains hidden or 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
$ONCE | |
Insert into Contacts (FirstName, LastName, Company) | |
Values | |
$EACH+ | |
('$0', '$1', '$2')<% if ($rownumOne != $numrows) {','} %> |
This file contains hidden or 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
#!/usr/bin/python | |
import imaplib | |
import csv | |
from email import message_from_string | |
import time | |
srv = imaplib.IMAP4_SSL("imap.gmail.com") | |
srv.login('[email protected]', 'joepw') | |
srv.select('[Gmail]/Drafts') |
This file contains hidden or 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 au_lname, au_fname, title, Category = | |
CASE | |
WHEN (SELECT AVG(royaltyper) FROM titleauthor ta | |
WHERE t.title_id = ta.title_id) > 65 | |
THEN 'Very High' | |
WHEN (SELECT AVG(royaltyper) FROM titleauthor ta | |
WHERE t.title_id = ta.title_id) | |
BETWEEN 55 and 64 | |
THEN 'High' | |
WHEN (SELECT AVG(royaltyper) FROM titleauthor ta |
This file contains hidden or 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 * | |
FROM OPENROWSET(BULK 'c:\temp\Customers.txt', | |
FORMATFILE = 'c:\temp\CustomersFmt.xml') AS SRC; | |
SELECT * | |
FROM OPENROWSET(BULK 'c:\temp\Customers.txt', | |
FORMATFILE = 'c:\temp\CustomersFmt.xml') AS SRC; | |
Similarly, the OPENROWSET function can be used directly in the USING clause of the MERGE statement, like so: | |
MERGE INTO Sales.MyCustomers AS TGT | |
USING OPENROWSET(BULK 'c:\temp\Customers.txt', | |
FORMATFILE = 'c:\temp\CustomersFmt.xml') AS SRC |
This file contains hidden or 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
USE TableName | |
MERGE TOP (1) Product_Master_Table AS a | |
USING | |
(SELECT model_number,COUNT(*) AS dupeCount | |
FROM Product_Staging_Table | |
WHERE model_number <> '' AND model_number IS NOT NULL | |
GROUP BY model_number | |
HAVING COUNT(*) > 1) AS b |