1
0
mirror of https://github.com/Microsoft/sql-server-samples.git synced 2025-12-08 14:58:54 +00:00

Added OData in IVS demo

Added nometadata and minimal metadata OData services in IVS demo. Minor
update in bcp (Belgrade Demo)
This commit is contained in:
Jovan Popovic
2017-03-28 12:44:02 +02:00
parent b33a758598
commit 12de4552ef
6 changed files with 277 additions and 7 deletions

View File

@ -1,8 +1,23 @@
<#@ output extension=".sql" #>
<#@ template language="C#" hostspecific="True" #>
SELECT *
FROM OPENROWSET(BULK '<#=this.Host.ResolvePath("..\\logs") #>\log-20170203.ndjson',
FORMATFILE = '<#=this.Host.ResolvePath("..\\logs") #>\linedelimited.fmt' );
FORMATFILE = '<#=this.Host.ResolvePath("..\\logs") #>\linedelimited.fmt' ) as logs;
DROP TABLE IF EXISTS Logs
--{"Timestamp":"2017-02-03T08:33:32.0776155+01:00","Level":"Information","MessageTemplate":"{HostingRequestFinished:l}","Properties":{"ElapsedMilliseconds":154.2332,"StatusCode":200,"ContentType":null,"HostingRequestFinished":"Request finished in 154.2332ms 200 ","EventId":{"Id":2},"SourceContext":"Microsoft.AspNetCore.Hosting.Internal.WebHost","RequestId":"0HL2C0RQ64LNN","RequestPath":"/"},"Renderings":{"HostingRequestFinished":[{"Format":"l","Rendering":"Request finished in 154.2332ms 200 "}]}}
CREATE TABLE Logs (
Data NVARCHAR(MAX),
Timestamp AS CAST(JSON_VALUE(Data, '$.Timestamp') as datetime2),
Level AS CAST(JSON_VALUE(Data, '$.Level') as nvarchar(40)),
ElapsedMilliseconds AS CAST(JSON_VALUE(Data, '$.Properties.ElapsedMilliseconds') AS float),
StatusCode AS CAST(JSON_VALUE(Data, '$.Properties.StatusCode') AS int)
)
BULK INSERT Logs
FROM '<#=this.Host.ResolvePath("..\\logs") #>\log-20170203.ndjson'
WITH (FORMATFILE = '<#=this.Host.ResolvePath("..\\logs") #>\linedelimited.fmt')