Posts

Showing posts from March, 2020

How to read XML file from SQL Server. The OPENXML statement and a little bit of Datascience

Image
Hi Guys, Welcome back! Would you like to learn how to read XML file from SQL Server ? Would you like to learn how to use the OPENXML statement ? Today we will do also some datascience.  So what are you waiting for? … Follow me! Introduction XML files are very popular nowadays. They are nothing more than text files with a structure established by means of tags . An example of an XML file could be this: < ROOT > < ROW          STAZIONE = "san pietro capofiume "         DATAINIZIO = "31/12/2018 23.00.00"         DATAFINE = "01/01/2019"         STRUMENTO = "api 200e"         NO2 = "28"         UM = " ug /m3"         F1 = ""         F2 = "1"   ...

From SQLServer to ML, a first little step into machine learning

Image
Hi Guys, Welcome back! Today a totally new argoument! It is now clear that the next big wave will be the AI (artificial intelligence) and the ML (Machine Learning) . I know you already have an installation of SQL Server installation. So let's see how to install machine learning services and the R language! Follow me! How to install machine learning services  Start the installation program and choose the first item. In italian “ Nuova installazione autonoma di SQL Server o aggiunta di funzionalità a un’installazione esistente ” Now choose the first checkbox “ Esegui una nuova installazione di SQL Server 2017 ” Choose the functions: Machine Learning Services (In-Database) R (aka R language) Install the Launchpad service: Now the installation come to the end: Restart the SQL Server instance! Now you need to enable the execution of the external scripts . You can do this through this command: sp_configure 'exter...

How to solve EXECUTE Permission denied on object 'sp_send_dbmail'

Image
Hi guys, Welcome back ! Today a light five minute post to talk about this error: EXECUTE permission denied on object 'sp_send_dbmail', database 'msdb', schema 'dbo'. ..or in italian language: Autorizzazione execute negata per l'oggetto 'sp_send_dbmail' del database 'msdb' con schema 'dbo' The sp_send_dbmail You know that this stored procedure is used to send a mail through SQL server. You know also that this stored procedure is contained into the MSDB system Databases. But if you get the error above? What can you do? How to solve the execute permission denied on sp_send_dbmail You should consider that: Your user must be in the MSDB database.  Your user must be also member of the DatabaseMailUserRole .  You can solve the problem in this way: 1) In the Object Explorer of the SQL Server management Studio, locate the Security / Account menu. Locate your user and do a double click on it. 2) In the opene...

Inside the SQL Server Query Optimizer - part 7 cost bases optimization phases

Image
Hi Guys, Welcome back! Are you ready for the last post of the series " Inside the SQL Server Query Optimizer "? Let's go! Introduction You will surely remeber that in a previous post Inside the SQL Server Query Optimizer - part 4 Trivial Plan we talked about trivial plans. Today we do another step forward. Consider infact that rarely a Query is eligible for a trivial plan. This is because as soon as we have an aggregate function or a union we can have multiple implementations and so a cost based decision is required. Well, we have that if a Query is not eligible for a trivial plan then the optimizer proceeds with next steps called phases. These Phases are: Transaction processing or Search 0 Quick plan or Search 1 Quick plan with parallelism  Full optimization or Search 2 Therefore we analyze each phase! Transaction processing (Search 0) The goal of this first phase is to find quickly an execution plan using only a limited set of rules. The ...

SQL server, Corona virus, Smartworking and the Index of the blog

Image
Hi Guys, Welcome back! This time an introduction is needed expecially for my friends who live in different countries than Italy.  Here in Italy Corona Virus is hitting hard but we certainly won't stop! A thought to those who have lost a loved one or their job. Introduction I must admit that is strange to write a post in the days of the coronavirus. Today for me and for some other collegues is the first day of smartworking . All right, I must say, but the change in habits is felt. Last night I had already prepared everything I needed but today a little anxiety about possible technical problems was definitely in the air! So there is no time left for any post and for this reason I decided to publish the index of all the posts written during these months. 83 posts have already been published. All posts are written both with the desire to communicate a passion and to convey concepts and practical things that can be useful to most . First posts were written in italian l...