Git Product home page Git Product logo

sql-server-samples's Introduction

Azure Data SQL Samples Repository

This GitHub repository contains code samples that demonstrate how to use Microsoft's Azure Data products including SQL Server, Azure SQL Database, Azure Synapse, and Azure SQL Edge. Each sample includes a README file that explains how to run and use the sample.

Please note that specific features, such as In-Memory OLTP, are edition-specific for SQL Server. These features will only be available if the edition that supports them is used to run the sample.

Releases in this repository

Releases provide convenient downloads of sample databases and applications, eliminating the need to build them from source code. This SQL Server samples repository offers the following notable releases:

To see the complete list of resources in this repository, navigate to Releases

Working in GitHub

To contribute on GitHub, follow these steps:

  • Visit https://github.com/microsoft/sql-server-samples and fork the repository.
  • Work in your forked repository.
  • When you're ready to make changes or publish your sample for the first time, submit a pull request into the 'master' branch of 'sql-server-samples'.
  • One of the approvers will review your request and either accept or reject the pull request.

Each sample should be in its own folder with a README.md file that follows the template. Generated files (e.g., .exe or .bacpac) and user configuration settings (e.g., .user) should not be committed to GitHub.

Cloning only a subset of the repo (with sparse checkout)

You can follow the steps below to clone individual files from the sql-server-samples git repo. Note: The following script clones only the files under the features and demos folders.

git clone -n https://github.com/Microsoft/sql-server-samples
cd sql-server-samples
git config core.sparsecheckout true
echo samples/features/*| out-file -append -encoding ascii .git/info/sparse-checkout
echo samples/demos/*| out-file -append -encoding ascii .git/info/sparse-checkout
git checkout

For more information about sparse checkout please visit this stackoverflow thread.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

These samples and templates are all licensed under the MIT license. See the license.txt file in the root.

Questions

Email questions to: [email protected].

sql-server-samples's People

Contributors

ajlam avatar akatesmith avatar alexprotsenko avatar altanatsedenova avatar ananto-msft avatar anosov1960 avatar barbkess avatar carlrabeler avatar dependabot[bot] avatar drediske avatar ebruersan avatar jeroenterheerdt avatar jocapc avatar jodebrui avatar jovanpop-msft avatar mihaelablendea avatar mikeraymsft avatar nelgson avatar perrysk-msft avatar pietervanhove avatar pmasl avatar ravage84 avatar segovoni avatar shivsood avatar srdan-bozovic-msft avatar thebharath avatar twright-msft avatar uc-msft avatar vasiyakrishnan avatar zhoufang928 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sql-server-samples's Issues

Handling Errors while running the scripts of TelcoChurn-Main.sql and TelcoChurn-Operationalize.sql.

Hi,
After installing SQL Server 2016 developer edition and trying for this Telco Customer churn sql server scripts.
I got certain error while running scripts TelcoChurn-Main.sql and TelcoChurn-Operationalize.sql.
For first , after google I found out we need to change the Memory_Limit_percent in order to run above sql scripts. so, just add MEMORY_LIMIT_PERCENT=50 into the config file for Rlauncher.config which can be found in below location:
C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Binn
Change as below;
RHOME=C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\R_SERVICES
MPI_HOME=C:\Program Files\Microsoft MPI
INSTANCE_NAME=MSSQLSERVER
TRACE_LEVEL=1
JOB_CLEANUP_ON_EXIT=1
USER_POOL_SIZE=0
WORKING_DIRECTORY=C:\PROGRA1\MICROS3\MSSQL11.MSS\MSSQL\EXTENS1
MEMORY_LIMIT_PERCENT=50

While running this script TelcoChurn-Operationalize.sql we need to firstly installed the required R packages,
I have also uploaded one SQL File which installed required R packages before running the scripts of telco customer churn into my fork repository for sql-server-samples. The file contains Enabling sp_execute_external_script to run R scripts in SQL Server 2016 and installing required R packages in order to run the Script TelcoChurn-Main.sql and TelcoChurn-Operationalize.sql sucessfully. since we need to install those R packages before we run the scripts in order to avoid the error .
https://github.com/maharjananil/sql-server-samples/blob/master/samples/features/r-services/Telco%20Customer%20Churn/SQL%20Server/Enabling%20R%20scripts%20to%20run%20and%20Installing%20required%20R%20Packages.sql

so, I think it will be helpful to upload the new SQL file in official repository too.

Thanks,
Anil Maharjan

Doesn't deploy to Azure

The ones that say they work for Standalone SQL and AzureDB or Azure DW is inaccurate for Azure. You cannot deploy DW as a data warehouse component just a regular sql azure database. The History Tables and other pieces for Temporal requirements do not work either as the versioning does not exist which then breaks the helpful data generation sproc. Can this please get corrected as it is sort of hard to demo features in Azure if the sample which is supposed to be the newest to replace adventureworks does not work out of the box... if one thing is broken who knows what else is, that is not encouraging at all to new Dev's who expect to start with a working component

logs to stdout

I tried today the microsoft/mssql-server-linux.
It crashed.

it tells me

Microsoft(R) SQL Server(R) setup failed with error code 1. Please check the setup log in /var/opt/mssql/log for more information.

It would be amazing if the errors were on stdout instead, so that they are available in docker logs.

Build dockerfile is not working

Hi, I am struggling this morning to run the dockerfiles suggested here but no single one is working. After downloading the windows core image,They are all failing on the line to downalod the sqlexpress with the following error

Step 9/11 : RUN powershell -Command (New-Object System.Net.WebClient).DownloadFile('%sql_express_download_url%', 'sqlexpress.exe') && /sqlexpress.exe /qs /x:setup && /setup/setup.exe /q /A
CTION=Install /INSTANCENAME=SQLEXPRESS /FEATURES=SQLEngine /UPDATEENABLED=0 /SQLSVCACCOUNT="NT AUTHORITY\System" /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /TCPENABLED=1 /NPENABLED=0 /I
ACCEPTSQLSERVERLICENSETERMS && del /F /Q sqlexpress.exe && rd /q /s setup
---> Running in cd5cab6a2b72
Exception calling "DownloadFile" with "2" argument(s): "The remote server
returned an error: (404) Not Found."
At line:1 char:1

  • (New-Object System.Net.WebClient).DownloadFile('https://go.microsoft. ...
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : WebException
    
    

The command 'cmd /S /C powershell -Command (New-Object System.Net.WebClient).DownloadFile('%sql_express_download_url%', 'sqlexpress.exe') && /sqlexpress.exe /qs /x:setup && /setup/setup.ex
e /q /ACTION=Install /INSTANCENAME=SQLEXPRESS /FEATURES=SQLEngine /UPDATEENABLED=0 /SQLSVCACCOUNT="NT AUTHORITY\System" /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /TCPENABLED=1 /NPENABL
ED=0 /IACCEPTSQLSERVERLICENSETERMS && del /F /Q sqlexpress.exe && rd /q /s setup' returned a non-zero code: 1

Not working with web application

I tried to replicate the same logic as explained in Token Authentication sample for Azure Active Directory of this repo into a webApp but it doesn't work. However, your sample of console app works like a charm. What is different? Or am I missing something?

Double-Hop Support

I haven't set up a test yet, but will this work with a double- or n-hop?

Some possible scenarios:
User's machine -> .NET Web Application -> Azure SQL DB
User's machine -> .NET Web Application -> .NET Application Tier -> Azure SQL DB

Invalid volume spec when using -v parameter

I'm running this on Hyper-V 2016:

docker run -d -p 1433:1433 -v C:/temp/:C:/temp/ -e sa_password=<MY_SUPERSECURE_PASSWORD> -e ACCEPT_EULA=Y microsoft/mssql-server-windows-express

Gives me this error

docker : C:\Program Files\Docker\docker.exe: Error response from daemon: invalid bind mount spec "C:/temp/:C:/temp/": invalid volume specification:
'C:/temp/:C:/temp/': invalid mount config for type "bind": GetFileAttributesEx c:\temp\: The filename, directory name, or volume label syntax is
incorrect..
    + CategoryInfo          : NotSpecified: (C:\Program File... is incorrect..:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

mssql-server-linux setup failed: error code 1 macOS (Docker)

When trying to startup sql-server I get this error. Is the log only contained in the docker container?

$ docker run -p 1433:1433 -t  -e SA_PASSWORD='<password>' -e ACCEPT_EULA=Y microsoft/mssql-server-linux
Configuring Microsoft(R) SQL Server(R)...
Microsoft(R) SQL Server(R) setup failed with error code 1. Please check the setup log in /var/opt/mssql/log for more information.

But while in the container... The mssql folder is not there!

root@bdd24ed25e8b:/var/opt# ls
root@bdd24ed25e8b:/var/opt# 

Not playing well with EF6 Designer

Some experiments have seemingly narrowed a problem down to this database. I tried the same with adventureworks in SQL Server 2016 and it's not a problem.

In VS2015 SP2 with latest SSDT tools (june 2016), SQL Server 2016 Developer Edition and SSMS for SQL Server 2016 installed.

Create new class library project.

Add new item: Entity Framework Data Model.

Select connection to World Wide Importers (not DW) on SQL Server 2016 instance.

Select all tables.

Go (which will install EF6 package and reverse engineer itables into classes).

It takes about 3 minutes. It should take about 10 seconds max.

Doing the same with AdventureWorks (not LT) is about 10 seconds.
I did this a number of time and each time it takes a while.
Is there something particular about the database schema or special SS2016 features that might create this problem? I don't normally recommend building a model from an entire database but this also happens if I only select a handful of tables.
It seems specific to the database and will make it hard for people to use when using it to explore EF.

On the other hand, I know how Greg feels about EF so maybe it's intentional. JUST KIDDING! :)

Problem with downloading DTSX file

I am trying to download the dtsx file in order to open in it in visual studio in order to learn from your design for the ETL workflow. Is there anyway I can do that?

MacOS - Error: 17113, Severity: 16, State: 1.

I am running docker 1.12.3 on macOS El Capitan.

Docker can use 9GB Ram of total 16GB.

docker-memory

When I run:

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=2TY-Q_VN_wnR!1YZS1xd0c_b!7AUb_2rd7hJG!xihdG!8uNCavA!Rw' -p 1433:1433  -v /Users/clouless/docker/mssql/opt:/var/opt/mssql microsoft/mssql-server-linux

It gives me the Error message:

Configuring Microsoft(R) SQL Server(R)...
Microsoft(R) SQL Server(R) setup failed with error code 1. Please check the setup log in /var/opt/mssql/log for more information.

I have mounted the /var/opt/ to my host and when I cat the logfile it says:

cat ~/docker/mssql/opt/log/errorlog

2016-12-08 15:36:52.13 Server      Microsoft SQL Server vNext (CTP1) - 14.0.1.246 (X64)
	Nov  1 2016 23:24:39
	Copyright (c) Microsoft Corporation
	on Linux (Ubuntu 15.10)
2016-12-08 15:36:52.19 Server      UTC adjustment: 0:00
2016-12-08 15:36:52.20 Server      (c) Microsoft Corporation.
2016-12-08 15:36:52.22 Server      All rights reserved.
2016-12-08 15:36:52.24 Server      Server process ID is 4116.
2016-12-08 15:36:52.26 Server      Logging SQL Server messages in file 'C:\var\opt\mssql\log\errorlog'.
2016-12-08 15:36:52.29 Server      Registry startup parameters:
	 -d C:\var\opt\mssql\data\master.mdf
	 -l C:\var\opt\mssql\data\mastlog.ldf
	 -e C:\var\opt\mssql\log\errorlog
2016-12-08 15:36:52.35 Server      Command Line Startup Parameters:
	 --setup
	 --sa-password
2016-12-08 15:36:52.52 Server      Error: 17113, Severity: 16, State: 1.
2016-12-08 15:36:52.52 Server      Error 2(The system cannot find the file specified.) occurred while opening file 'C:\var\opt\mssql\data\master.mdf' to obtain configuration information at startup. An invalid startup option might have caused the error. Verify your startup options, and correct or remove them if necessary.
2016-12-08 15:36:52.64 Server      SQL Server shutdown has been initiated

Powershell cmdlets mentioned in the doc are old

Please update the documentation to show newer (ver. 2) azure cmdlets. For instance, connect-msolservice needs to be replaced with Connect-AzureAD and similarly New-MsolServicePrincipalCredential needs to be replaced with updated cmdlet.

not able to pull microsoft/mssql-server-2014-express-windows

When I try to pull sql 2014 express on windows 10 with docker, I get an error. See following for the example:
PS C:\Users\Prashant> docker pull microsoft/mssql-server-2014-express-windows Using default tag: latest latest: Pulling from microsoft/mssql-server-2014-express-windows 1239394e5a8a: Downloading 1277c1a047c0: Download complete 7836e8cf3dc2: Download complete bfff1a38c8ba: Download complete f82efbd6f52b: Download complete 5a3874353855: Download complete 3487f0e37f4b: Download complete 19dee413779d: Download complete 6e9dc0f189d0: Download complete aaa4f05bd7e7: Download complete 124c608fd8c6: Download complete fa9da3d0ab45: Download complete unknown blob

Failed to start service 'SQL Server (SQLEXPRESS)

I created the container with docker-compose 1.0

Here is the yaml:

mssql-server-2014-express-windows:
  environment:
    sa_password: '12345678'
  image: microsoft/mssql-server-2014-express-windows:latest
  labels: {}
  ports:
  - 1433:1433
  restart: unless-stopped

Here is the container's log

PS C:\Users\cai> docker logs 9d69a4c4f4c7
docker : start-service : Failed to start service 'SQL Server (SQLEXPRESS) 
At line:1 char:1
+ docker logs 9d69a4c4f4c7
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (start-service :...r (SQLEXPRESS) :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

(MSSQL$SQLEXPRESS)'.
At C:\start.ps1:9 char:1
+ start-service MSSQL`$SQLEXPRESS
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceControl 
   ler:ServiceController) [Start-Service], ServiceCommandException
    + FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands 
   .StartServiceCommand

Invoke-Sqlcmd : A network-related or instance-specific error occurred while 
establishing a connection to SQL Server. The server was not found or was not 
accessible. Verify that the instance name is correct and that SQL Server is 
configured to allow remote connections. (provider: SQL Network Interfaces, 
error: 26 - Error Locating Server/Instance Specified)
At C:\start.ps1:14 char:5
+     Invoke-Sqlcmd -Query $sqlcmd -ServerInstance ".\SQLEXPRESS"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Invoke-Sqlcmd], SqlExcept 
   ion
    + FullyQualifiedErrorId : SqlExectionError,Microsoft.SqlServer.Management. 
   PowerShell.GetScriptCommand

Invoke-Sqlcmd : 
At C:\start.ps1:14 char:5
+     Invoke-Sqlcmd -Query $sqlcmd -ServerInstance ".\SQLEXPRESS"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Invoke-Sqlcmd], ParserExceptio 
   n
    + FullyQualifiedErrorId : ExecutionFailureException,Microsoft.SqlServer.Ma 
   nagement.PowerShell.GetScriptCommand

start-service : Failed to start service 'SQL Server (SQLEXPRESS) 
(MSSQL$SQLEXPRESS)'.
At C:\start.ps1:9 char:1
+ start-service MSSQL`$SQLEXPRESS
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceControl 
   ler:ServiceController) [Start-Service], ServiceCommandException
    + FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands 
   .StartServiceCommand

And the docker ps shows it still running

PS C:\Users\cai> docker ps
CONTAINER ID        IMAGE                                                COMMAND                  CREATED             STATUS  
            PORTS                    NAMES
9d69a4c4f4c7        microsoft/mssql-server-2014-express-windows:latest   "cmd /S /C 'powershel"   23 minutes ago      Up 6 min
utes        0.0.0.0:1433->1433/tcp   sqlserver_mssql-server-2014-express-windows_1

need help

Unknown Customers in DW due to NULL BuyingGroupID in WideWorldImporters.Sales.Customers

I've generated data in the WideWorldImporters database and run the SSIS package to populate the DW database. When I do this I get a large number of transactions with Unknown customers.
The reason appears to be that there are only two buying groups defined in the source database (Tailspin Toys and Wingtip Toys) and the rest of the customers have NULL for their BuyingGroupID. It looks as though this is acceptable, as not all customers would be part of a buying group, but the [Integration].[GetCustomerUpdates] procedure INNER JOIN's on to the BuyingGroups table. Due to this INNER JOIN, I'm only getting customer records in the DW database for Tailspin & Wingtip customers.
I've tried changing the INNER JOIN's in the [Integration].[GetCustomerUpdates] procedure, but this then breaks integrity constaints in the DW database so the customers won't load.
It may be that all customers should have a default BuyingGroup and something has gone wrong during my initial population of data, but I've checked through the scripts and it doesn't look like it.
Can anyone help?

Poor Index Naming Convention

This may seem silly, but indexes that were created to support foreign key constraints seem to have been named in this database with an FK_* prefix, which I do not think sets a good example for a preferred naming convention.

Example:

CREATE NONCLUSTERED INDEX [FK_Application_Cities_StateProvinceID] ON [Application].Cities
(
[StateProvinceID] ASC
);

This naming convention is normally used exclusively for foreign key constraints. This naming convention is also used for foreign key constraints in this database.

I would suggest renaming these indexes to follow an IX_* prefix naming convention.

So many people use these sample databases as a "Microsoft best practices", that I would like to prevent having to argue and fix these things in the field down the road in customer created databases.

References for preferred naming standards:

http://sqlmag.com/blog/sql-server-index-naming-guidelines

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/431e5cf1-56b2-4a03-a7d9-183891973946/what-should-be-the-naming-convention-for-indexes?forum=transactsql

http://stackoverflow.com/questions/2783495/sql-server-index-naming-conventions

http://blog.sqlauthority.com/2012/05/21/sql-server-renaming-index-index-naming-conventions/

sql vnext url doesn't work

ENV sql_vnext_download_url "https://go.microsoft.com/fwlink/?linkid=829176" <-- is broken

error:

---> Running in e82b95de732a
Exception calling "DownloadFile" with "2" argument(s): "The remote server
returned an error: (404) Not Found."
At line:1 char:1

  • (New-Object System.Net.WebClient).DownloadFile('https://go.microsoft. ...
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : WebException
    

Cannot restore WideWorldImporters-Full to Express version DB Engine.

I am using:
Windows 10 Pro 64bit
SQL Server 2016 Express SP1 with CU3

Restore both WideWorldImporters-Full and WideWorldImportersDW-Full, It show (SQL server service not starting with error code: 3414)

I stay back and try the legacy version:
WideWorldImporters-Standard.bak
and
WideWorldImportersDW-Standard.bak

It success without any error.

Antlr4.Runtime not found

I was trying to run the example from (https://github.com/Microsoft/sql-server-samples/blob/master/samples/features/json/azure-function-odata/azure-function/run.csx).

But the functions refuses to run with this error message:
2017-05-01T14:29:03.255 C# Http trigger function exception: Could not load file or assembly 'Antlr4.Runtime, Version=4.5.0.0, Culture=neutral, PublicKeyToken=09abb75b9ed49849' or one of its dependencies. The system cannot find the file specified.

project.json file was added successfully.

Create a localdb edition?

any chance of creating a version I can use with localdb? I believe the "WWIDW_InMemory_Data_1" file group is preventing me from restoring this on a machine with VS2015 and a SQL Server 2016 localdb but not full install.
Thanks

Thought I would relay what I've been doing and what results I got that drove me to this conclusion.

I downloaded WideWorldImportersDW-Full.bak (hoping for the simplest one...did I choose well?)

I looked at the file list with :
RESTORE FILELISTONLY FROM Disk= 'C:\Users\Julie\Downloads\WideWorldImportersDW-Full.bak'
Then tried to restore this way:

RESTORE DATABASE [WideWorldImporters]
FROM Disk= 'C:\Users\Julie\Downloads\WideWorldImportersDW-Full.bak'
     WITH MOVE 'WWI_Primary' TO 'D:\databases\wwwimporters.mdf',  
   MOVE 'WWI_Log' TO 'D:\databases\wwwimporters.ldf';  

resulting error is:
The database cannot be started in this edition of SQL Server because it contains a MEMORY_OPTIMIZED_DATA filegroup. See Books Online for more details on feature support in different SQL Server editions.

Then I tried to just restore the primary file

RESTORE DATABASE [WideWorldImporters]
FILE='WWI_Primary'
FROM Disk= 'C:\Users\Julie\Downloads\WideWorldImportersDW-Full.bak'
WITH MOVE 'WWI_Primary' TO 'D:\databases\wwwimporters.mdf'

And got another memory data related error:
A BACKUP or RESTORE DATABASE statement that includes the primary filegroup must include the MEMORY_OPTIMIZED_DATA filegroup, and vice versa.

Daily ETL package skips data with incremental load

When refreshing data in the WWI sample databases, the SSIS package DailyETL can possible skip data when you're trying to incrementally load the data. (the documentation suggests to do a full load by reseeding the DWH first, but that's hardly a best practice)

For example, if I generate data for the Wide World Importers database using the stored procedure [DataLoadSimulation].[PopulateDataToCurrentDate], data is generated right until yesterday included. So if today is 19 September 2016, the last date will be the 18th of September 2016. When you run the SSIS package, the new cutoff time will be calculated as the current datetime - 5 minutes (e.g. 2016-9-19T21:50:00). So a certain point in time on the 19th of September 2016. All changes will be succesfully loaded into the DWH. When the ETL is done, the new cutoff time is written to the Integration.[ETL Cutoff] table in the DWH.

If at a later point in time I generate data again for the WWI database, data will also be generated for the 19th of September 2016. With the example of a cutoff time of 2016-9-19T21:50:00, you miss all changes from 2016-9-19T00:00:00 until 2016-9-19T21:50:00.

Instead of using a calculated cutoff time which is the same for all tables, it's maybe better to use the latest change date (e.g. LastEditedWhen) that can be found. For example:

DECLARE @NewCutfOff DATETIME = (SELECT MAX(LastEditedWhen) FROM Sales.Orders);

test this editor tool

My project is same : https://github.com/pauldotknopf/react-aspnet-boilerplate

How can i upgrade react-router 3.0 to 4.0
MY CONFIG IS :
FILE server.js :
`import isEmpty from 'utils/isEmpty';
import React from 'react';
import ReactDOM from 'react-dom/server';
import { match } from 'react-router';
import { Provider } from 'react-redux';
import createHistory from 'react-router/lib/createMemoryHistory';
import RouterContext from 'react-router/lib/RouterContext';
import Html from './helpers/Html';
import getRoutes from './routes';
import configureStore from './redux/configureStore';

export function renderView(callback, path, model, viewBag) {
const history = createHistory(path);
const store = configureStore(model, history);
const result = {
html: null,
status: 404,
redirect: null
};
match(
{ history, routes: getRoutes(store), location: path },
(error, redirectLocation, renderProps) => {
if (redirectLocation) {
result.redirect = redirectLocation.pathname + redirectLocation.search;
} else if (error) {
result.status = 500;
} else if (renderProps) {
const isNotFound = renderProps.routes.filter(route => route.status === 404).length > 0;
result.status = isNotFound ? 404 : 200;
const component =
(

<RouterContext {...renderProps} />

);
if (!isEmpty(viewBag)) {
store.dispatch({ type: '_HYDRATE_VIEWBAG', viewBag });
}
result.html = ReactDOM.renderToString();
} else {
result.status = 404;
}
});
callback(null, result);
}

export function renderPartialView(callback) {
callback('TODO', null);
}`

Database creation

Hi,

Should the container create the specified database during startup if it does not exist. I'm running this:

docker run --ip 172.16.13.30 --net MyNatNetwork -p 1433:1433 -v C:/temp/:C:/temp/ --env attach_dbs="[{'dbName':'test','dbFiles':['C:\\temp\\test.mdf','C:\\temp\\test_log.ldf']}]" microsoft/mssql-server-2016-express-windows

However this throws the following error:

VERBOSE: Starting SQL Server
VERBOSE: Attaching 1 database(s)
VERBOSE: Invoke-Sqlcmd -Query sp_detach_db test;CREATE DATABASE test ON (FILENAME
 = N'C:\temp\test.mdf'),(FILENAME = N'C:\temp\test_log.ldf') FOR ATTACH ;
-ServerInstance '.\SQLEXPRESS'
Invoke-Sqlcmd : The database 'test' does not exist. Supply a valid database
name. To see available databases, use sys.databases.
Unable to open the physical file "C:\temp\test.mdf". Operating system error 2:
"2(The system cannot find the file specified.)".
CREATE DATABASE failed. Some file names listed could not be created. Check
related errors.
At C:\start.ps1:41 char:3
+         Invoke-Sqlcmd -Query $sqlcmd -ServerInstance ".\SQLEXPRESS"
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Invoke-Sqlcmd], SqlPowerS
   hellSqlExecutionException
    + FullyQualifiedErrorId : SqlError,Microsoft.SqlServer.Management.PowerShe
   ll.GetScriptCommand

Internet explorer in containers

Hi! Sorry for writing issue here. Don't found the place to file to.
For test automation purposes it will be great to see windows containers with internet explorer onboard.
As I can see there is on IE on windowsservercore images.

How do I cn solve this problem?

Login failed on export

Error message is:

Unable to reconnect to database: Cannot open database "DATABASENAME_2017-02-02_18:31.02" requested by the login. The login failed.
Login failed for user 'USERNAME'.

Cannot open database "DATABASENAME_2017-02-02_18:31.02" requested by the login. The login failed.
Login failed for user 'USERNAME'.

The user credentials are being set in this line:
$serverCred = Get-AutomationPSCredential -Name 'dbBackupsUser';

And the dbBackupsUser credential asset is set with the username and password that our account admin uses to log into the database (with SSMS or similar). The really screwy thing is that if I stop the process before it attempts an export and then just run the section of the script that starts the export, it's more than happy to proceed. This is only an issue when I'm running the full script, and it just finished copying the database.

dotnet-rest-api errors

Hi, I opened the project in VS 2017, got rght away an error box indicating that it can not be upgraded.
I switched to VS 2015, opened ProductCatalog.xproj, again I got a message as you can notice in the attached snapshot, however project was opened but cannot resotre packages, here is the error I an getting

error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.

Typo in release readme.md.

I can't find the release md file for the WWI sample. The descriptions for the .bacpac for OLTP and DW versions is the same. One should saw data warehousing, and one should be for OLTP. If you have a location in the repo for these files, I can fork and provide a PR.

WWI DW tables named with reserved keywords

Hi,

Fact.Order and Fact.Transaction in the WWI DW data model use reserve keywords for their names. This causes undelimited queries to fail against them.

For example :

select * from fact.order

returns the error :

Msg 156, Level 15, State 1, Line 4 Incorrect syntax near the keyword 'order'.

The same error is given when querying Fact.Transaction. To query each requires that the table name is delimited by square brackets.

Can these table names be modified to not use reserve keywords?

Thanks.

executing 6-wwi-data-simulation.sql never completes.

I executed 6-wwi-data-simulation.sql expecting it to take 20-30 minutes to complete. However, its been over 3 1/2 hours and it still hasn't completed. Looking at Messages tab in SSMS, it stopped printing the date after Tue Feb 23, 2016.

Here is the query I executed:

-- Run data simulation to populate the database.
-- Runtime: ~40 minutes

USE WideWorldImporters;
GO

SET NOCOUNT ON;

EXEC DataLoadSimulation.Configuration_ApplyDataLoadSimulationProcedures;
EXEC DataLoadSimulation.DailyProcessToCreateHistory 
    @StartDate = '20130101',
    @EndDate = '20160531',
    @AverageNumberOfCustomerOrdersPerDay = 60,
    @SaturdayPercentageOfNormalWorkDay = 50,
    @SundayPercentageOfNormalWorkDay = 0,
    @UpdateCustomFields = 1,
    @IsSilentMode = 1,
    @AreDatesPrinted = 1;
EXEC WideWorldImporters.DataLoadSimulation.Configuration_RemoveDataLoadSimulationProcedures;

And here is part of the Messages tab in SSMS (notice how the date stops printing after Tue Feb 23, 2016:

Successfully removed row level security
Successfully applied row level security
Successfully removed row level security
Tue Jan 01, 2013

Wed Jan 02, 2013

Thu Jan 03, 2013

Fri Jan 04, 2013

... (removed for brevity)

Sun Feb 21, 2016

Mon Feb 22, 2016

Tue Feb 23, 2016


Not Using SQLServerOFExample;

using SQLServerOFExample;

This is missing in program.cs which will cause build errors due to not being able to use EF Class created in EFSampleContent.cs

Node Js / Express Example is Broken

sql-server-samples/samples/features/json/todo-app/nodejs-express4-rest-api/

Hi guys,

Thanks for all the help with the samples and examples. Unfortunately I can't seem to get the express app to work, and have spent about 5 hours today trying to understand whats wrong with it.

At first I was unable to connect to the database on Azure, though this was an issue with the docs not mentioning that you must whitelist your IP to connect, which is important info for someone new to this process and setting up an account for the first time.

The connection appears to be working, however the app seems to stall at this point, and its unclear if any sql is being executed or if nothing is being returned.

I'm not a node expert, so maybe im missing something obvious. At present however, it seems that there are no working routes in the app that will produce a page, which I am guessing their should be?

Apologies if I am missing a key step, if the app is not supposed to produce any visible pages can that be made clear?

My understanding is that hitting the todo/ route should generate a list of to-dos from the database. At present there seems to be no response.

The last debug message I see is:

State Change: LoggedINSendingInitialSQL- > Loggedin

The the connected event fires, but nothing I can see after that.

Errors in generate-json-crud.sql

Running Code Gen Returns following:

Can anyone assist?
SQL Server Samples\sql-server-samples\samples\features\json\code-generator\generate-json-crud.sql

Msg 208, Level 16, State 1, Procedure GetTableColumns, Line 45 [Batch Start Line 56]
Invalid object name 'STRING_SPLIT'.
Msg 208, Level 16, State 1, Procedure GetPkColumns, Line 5 [Batch Start Line 108]
Invalid object name 'codegen.GetTableColumns'.
Msg 208, Level 16, State 1, Procedure GetTableDefinition, Line 5 [Batch Start Line 119]
Invalid object name 'codegen.GetTableColumns'.

Parsing error for attach_dbs environment variable

Hello,

When I use the -e attach_dbs="my json string" I get:
C:\Program Files\Docker\docker.exe: Error parsing reference: "โ€“e" is not a valid repository/tag: invalid reference format.
See 'C:\Program Files\Docker\docker.exe run --help'.

It seems that docker isn't understanding the "my json string" as a string and therefore -e isn't recognized as environment variable.
I tried single quotes with same result.

Any ideas?
Thank you in advance

Santos

Provide MDF sample database files

The array of options on http://msftdbprodsamples.codeplex.com/ is a great resource.

But with CodePlex going away, it would be helpful to have additional database files in this repository, which I believe will be the official place when codeplex is gone.

That way people who are using lighterweight tools like sqlcmd and don't have access to SSMS or sqlpackage.exe can still get sample databases to work with.

Thanks

Sql server localdb 2016 is not supported

I tried to restore the .bak under (LocalDB)\MSSQLLocalDB instance but failed as it doesn't support FileStream feature, is there any way to exclude the filestream and only restore the .mdf and .ldf ?

Warning message: In tempGetNumObs(numObs)

Hi ZhouFang928,
I've tried to follow your example "Telco Customer Churn v1", but I found some difficulties.
If I could, I have two questions to ask you.
First of all, can you confirm that I can not enable external scripts R on Azure SQL Database?

The second question concerns the execution of the code:
I ran all the steps correctly, created the functions and uploaded the data on my SQL Server 2016, but when I execute the following statement
system.time({ trainModel(sqlSettings, trainTable) })

content on telcoChurn-main.R script I get this wrong output:

Warning message: In tempGetNumObs(numObs) : Number of observations not available for this data source. 'numObs' set to 1e6.

And for this warning message, the function trainModel() does not create the object rx_forest_model

Do you have any suggestions on how to solve this problem?

Thank you very much

Further improvements to Java sample

I sent this to [email protected] but the mail bounced to here goes.

There are several ways in which the Java Samples could be improved.

  1. Idiomatic Java uses an upper case letter for the first character in
    class names. So "Connect" would be the idiomatic name of the "connect"
    class
    .
  2. It would be cool if the samples where directly executable. For that
    several things would need to happen
    1. An automated build has to be set up that compiles and executes the
      code. Maven is currently the most popular one.
    2. The driver JAR can be downloaded automatically from a Maven
      repository (can be consumed by build tools other than Maven) that is
      ideally synched with Maven Central. I'm sure Sonatype would be willing to lend you a hand. This may not be in your groups
      power to do but maybe you can forward this request to the right group. Doing
      this would make lives much easier for Java developers and would put
      you ahead of proprietary competitors.
    3. A continous integration build that verifies the samples run
      successfully. That may require some code changes like reading
      connection arguments from the command line.
  3. All samples that ship with the driver package could be moved to
    GitHub and maintained there. As well as the MSDN samples.

The object 'Colors_Archive' is enabled with data compression or vardecimal storage format. Data compression and vardecimal storage format are only supported on SQL Server Enterprise Edition.

When I try to restore WideWorldImporters-Standard.bak on my virtual machine with Microsoft SQL Server Standard (64-bit) 13.0.1601.5 I get two messages in the Windows Application log of the Eventviewer:

Database 'WideWorldImporters' cannot be started in this edition of SQL Server because part or all of object 'Colors_Archive' is enabled with data compression or vardecimal storage format. Data compression and vardecimal storage format are only supported on SQL Server Enterprise Edition.

and

Database 'WideWorldImporters' cannot be started because some of the database functionality is not available in the current edition of SQL Server.

And now I'm a bit disappointed.

With regards,

Johan van der Wilk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.