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
| import os | |
| import multiprocessing | |
| import random | |
| import time | |
| from services import logger | |
| LOG = logger.get_logger(os.path.basename(__file__)) | |
| proc_name = 'Parallel Processing Example using multiprocessing module' |
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
| ALTER FUNCTION [dbo].[UTC_TO_LOCAL_TIME_W_DST_ADJUST] (@DTTM DATETIME2 -- In UTC | |
| ) | |
| RETURNS DATETIME2 | |
| AS | |
| BEGIN | |
| --DECLARE @DTTM AS DATETIME2 = '01-Mar-2015 09:01:00'; | |
| DECLARE @LOCAL AS DATETIME2; | |
| DECLARE @DT_YEAR AS VARCHAR(4) = DATEPART(YEAR,@dttm); | |
| DECLARE @STARTDLS AS DATETIME2 = '01-Mar-' + @DT_YEAR; | |
| DECLARE @STOPDLS AS DATETIME2 = '01-Nov-' + @DT_YEAR; |
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
| /* This method has the best performance over other methods normally used (union all, etc)*/ | |
| SELECT TOP 50 | |
| INV.PONUMBER | |
| ,INV.KEYINDATE | |
| ,INV.PAIDDATE | |
| ,INV.DATE | |
| , | |
| (SELECT | |
| MAX(LASTUPDATEDATE) |
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
| -- the utc value | |
| declare @utc datetime = '20/11/2014 05:14' | |
| -- the local time | |
| select DATEADD(hh, DATEDIFF(hh, getutcdate(), getdate()), @utc) | |
| --Conversely (to go from local to UTC) | |
| DECLARE @LOCAL DATETIME = getdate(); |
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
| say you have a spreadsheet formatted thusly (for instance a survey form): | |
| timestamp, user, question | |
| '2013-01-01', person1, Y | |
| '2013-01-01', person2, Y | |
| '2013-01-01', person3, N | |
| and you want to get a count, by day, of the responses like: | |
| Date, Y, 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
| =query('2014_Q3'!$A$2:$B$8; "select B where A ='"&A2&"' ") |
NewerOlder