show sql errorlog messages since a specified date


This almost speaks for itself…but it might be worth noting that: I’m only interogating the latest file here it’s a teeny bit cumbersome – I would probably function-alize it the big advantage here compared to the GUI is you can cut-and-paste it _really easily_ $logs = dir sqlserver:\sql\_the_server_name $logs.readerrorlog(0) | where logdate -gt ([datetime]::ParseExact(’25/02/2015 07:27:36′,”dd/MM/yyyy … Read more

github and penflip


The github commands to edit a Penflip markdown document: git clone cd a-unix* gvim commands-summary.txt git add commands-summary.txt git commit -m ‘trying out penflip from the commandline :)’ git push -u origin master I downloaded Markdown Viewer add-on for Firefox, but this didn’t quite work with the down-loaded penflip document. The viewer only renders … Read more

system databases not included in powershell sqlserver provider ‘databases’ folder


I hadn’t noticed this before. If you do a dir listing of the databases for an instance within the Powershell Sqlserver provider, it doesn’t show the system databases PS C:\powershell> dir SQLSERVER:\SQL\my_pc\inst2012\databases Name Status Recovery Model CompatLvl Collation Owner —- —— ————– ——— ——— —– AdventureWorks2012 Normal Simple 110 SQL_Latin1_General_CP1_CI_AS matty TSQL2012 Normal Full 110 … Read more

70-461 – notes from ch. 2 – identity, newId, newSequentialId and sequences


_identity_ is set up as ‘int identity‘ in the create table newid() is functionally similar but you get a 36 character field newsequentialid is like newid but you can see a sequntial increase sequences are like in Oracle Identity To use the automatic identity thing: drop table aa.tax_dodgers; create table aa.tax_dodgers (id1 int identity, name … Read more

70-461 – notes for ch. 2 – concat, concat_null_yields_null, substring, charindex, patindex


Anything + null = null Concat anything with null, just returns the anything. i.e. null = ” concat_null_yields_null makes concat work like + substring is like the Oracle substr charindex is like the Oracle instr patindex is like the Oracle instr but with pattern matching concat vs. ‘+’ A null ‘+’ anything returns a null … Read more

70-461 – notes for ch. 2 – case, coalesce, isnull, iif, choose


Simple case tests one expression against various values Searched case could be unrelated expression Coalesce returns the first non-null value in a list. It’s like a multi-alternative nvl and is standard SQL Isnull is more like nvl in that it’s ‘if this is null then use that’, but it’s non-standard. Nullif would be better called … Read more