This file contains 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
DECLARE @day datetime | |
SET @day = '18000101' | |
DECLARE @dimDaysVar TABLE ( | |
[DayKey] int, | |
[Year] smallint, | |
[Month] tinyint, | |
[Day] tinyint, | |
[DayOfWeek] tinyint, | |
[Week] tinyint, |
This file contains 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
INSERT Locations (Name, Position) | |
VALUES ('Golden Gate Bridge', geography::STPointFromText('POINT(-122.478255 37.819929)', 4326)) | |
-- POINT(Longitude, Latitude) | |
-- UPDATE [dbo].[Landmark] | |
-- SET [GeoLocation] = geography::Point([Latitude], [Longitude], 4326) | |
-- GO |
This file contains 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 t.[name] AS [Table], | |
c.[name] AS [Column], | |
ex1.[value] AS [Description], | |
CASE | |
WHEN ty.[name] IN ('geometry', 'geography') THEN ty.[name] | |
WHEN ty.[name] IN ('decimal', 'numeric') THEN ty.[name] + '(' + CAST(c.[precision] AS VARCHAR(10)) + ', ' + CAST(c.[scale] AS VARCHAR(10)) + ')' | |
WHEN ty.[max_length] = c.[max_length] THEN ty.[name] | |
WHEN c.[max_length] = -1 THEN ty.[name] + '(MAX)' | |
ELSE ty.[name] + '(' + CAST(c.[max_length] AS VARCHAR(10)) + ')' | |
END AS [Type], |
This file contains 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
-- ============================================= | |
-- Create or Alter View template | |
-- ============================================= | |
USE <database_name, sysname, AdventureWorks> | |
GO | |
IF OBJECT_ID(N'[<schema_name, sysname, dbo>].[<view_name, sysname, Top10Sales>]', 'V') IS NULL | |
EXEC sp_executesql N'CREATE VIEW [<schema_name, sysname, dbo>].[<view_name, sysname, Top10Sales>] AS SELECT '''' as [x]' | |
GO |
This file contains 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
namespace Project.Migrations | |
{ | |
using System; | |
using System.Data.Entity.Migrations; | |
public partial class FileTableAdded : DbMigration | |
{ | |
public override void Up() | |
{ | |
Sql(@" |
This file contains 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
$.validator.methods.date = function (value, element) { | |
var extractGermanDate = function (dateString) { | |
var matches = /^(\d{1,2})\.(\d{1,2})\.(\d{4})( (\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/.exec(dateString); | |
if (matches == null) { | |
return false; | |
} else { | |
return { | |
day: matches[1], | |
month: matches[2] - 1, | |
year: matches[3], |
This file contains 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
$pcs = (Get-ADComputer -Filter * | ? { Test-Connection $_.DNSHostName -Quiet -Count 1 }).DNSHostName | |
Invoke-Command -ComputerName $pcs -ScriptBlock { | |
$result = query user | |
$success = $result[1] -match "^[> ]([^ ]+) +([^ ]+) +([0-9]+) +([^ ]+) +([^ ]+) +(.+)$" | |
if ($success) { | |
New-Object PSObject -Property @{ | |
PC = $env:computername; | |
Benutzername = $Matches[1]; | |
Sitzungsname = $Matches[2]; |
This file contains 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
$filterXml = '<QueryList> | |
<Query Id="0" Path="System"> | |
<Select Path="System">*[System[(Level=1 )]]</Select> | |
</Query> | |
</QueryList>' | |
$pcs = (Get-ADComputer -Filter * | ? { Test-Connection $_.DNSHostName -Quiet -Count 1 }).DNSHostName | |
$pcs | % { | |
Get-WinEvent -FilterXml $filterXml -ComputerName $_ | ? TimeCreated -GT (Get-Date).AddMonths(-1) |
This file contains 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
static string ConsoleReadPassword() | |
{ | |
StringBuilder stringBuilder = new StringBuilder(); | |
ConsoleKeyInfo keyInfo = Console.ReadKey(true); | |
while (keyInfo.Key != ConsoleKey.Enter) | |
{ | |
if (keyInfo.Key == ConsoleKey.Backspace) | |
{ | |
stringBuilder.Remove(stringBuilder.Length - 1, 1); |
This file contains 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
using Microsoft.SqlServer.TransactSql.ScriptDom; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace TransactSqlScriptDomTest | |
{ |
NewerOlder