Microsoft R Open remote connection to R-Server In-Database - sql-server-2016

I'm pretty confused with the different R-Servers. There is the Standalone type and the In-Database type.
What I want is a connection from my R-Studio with Microsoft R Open 3.3.3 to the R Server In-Database type (with mrsdeploy) and not to the Standalone (I did not install the Standalone). Is this even possible? Or is mrsdeploy only working with the standalone type? Because there is no "Microsoft.RServer.Utils.AdminUtil.dll" at the In-Database type, where I could configure the webnode and cumputing node.

The in-database type is built into SQL Server 2016 (and later). There's no reason to connect your RStudio to the in-database R services. You would essentially use R Studio to write your code, troubleshoot your code, perfect your code, and then copy and paste your R code as text into SQL stored procedures and queries if you need to.
If you have a standalone R Server (not an in-database type), you can connect your R directly to it and work with data that's SQL or any other format. The whole purpose of the in-database R Services is to have your R script close to your data.
I would start by reading about the differences between SQL Server R Services (In-Database) and R Server (Standalone) on the Microsoft help pages.
https://learn.microsoft.com/en-us/sql/advanced-analytics/r/sql-server-r-services
I would then read about how to implement R scripts in your stored procedures using sp_execute_external_script.
Hope this helps.

Related

How to run deployed R Code from SQL server 2016

How can i run an R Code which is deployed in Microsoft R Server using sp_execute_external_script.
I have an R Script, which is pretty lengthy. Now i want to deploy that script to R Server, so that any one with privileges can access that script. Also i want to execute that script from an SQL Server Stored Procedure by referring the script that is deployed in R Server.
Is it possible to do that ?
tl;dr yes, you can.
I would recommend starting with this introduction from Microsoft:
https://msdn.microsoft.com/en-us/library/mt604885.aspx
When you understand it (and have set up a SQL Server 2016 correctly) the following tutorials can be helpful: https://msdn.microsoft.com/en-us/library/mt591993.aspx
Yes you can
Note: To run R code in Transact-SQL, you must be connected to an instance of SQL Server 2016 where SQL Server R Services is already installed .
Exemple:
exec sp_execute_external_script #language =N'R',
#script=N'OutputDataSet<-InputDataSet',
#input_data_1 =N'select 1 as hello'
with result sets (([hello] int not null));
go
Good Lock

Dump ERP queries in informix

We have a closed source application here, that connect to an informix database ( using odbc )
is there any way I can see the queries being executed by this application?
Turn on ODBC tracing. Some information can be found here.
Multiple possibilities :
those give all the statements
like mentioned above odbc tracing.
set explain on as pre sql (generates huge files with the sqls and query plans).
those the current running statements.
using onstat commands on the server running the database (onstat -g sql ).
connecting to the monitoring database (sysmonitor) and querying the session tables .

For a Front end access user interface connected to a backend SQL server, do I create new queries for tables in the SQL server or Access frontend?

I am a new database intern working with a access front end and SQL server backend database. The database was custom made for the company. One of my assignments is to take scripts and apply them to make four new tables. I am aware that I need to make a new query for each new table but I don't know if I should make the query in SQL server management studio or the frontend access program. I have tried copying and pasting the given scripts into a new query in access but I get an error message "invalid SQL statement expected 'DELETE', 'INSERT'...". I decided to try to break done the program a little bit and tested the first line
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id =OBJECT_ID(N'[dbo] .[FK_tblInstrumentInterfaceLog_tlkpInstrument]') AND parent_object_id = OBJECT_ID(N'[dbo].[tblInstrumentInterfaceLog]'))
but the same error message keeps popping up. I even tried just SELECT * FROM sys.foreign_keys, and I got the error message "could not find file...". I am very much a beginner and any guidance would be appreciated.Basically am I supposed to be applying these scripts the server SQL database or on the front end access program?
Are you using a pass-through query? i.e. not just a select query. Access needs to know where to send the query and since you are using TSQL not Access SQL this needs to be executed on the server.
Normally when you query a linked table the information of how to get the data (the connection string) is tied to the table. But for this kind of query you'll probably need to tell Access explicitly. Unless you are using an ADP/ADE, then the connection info travels with the program not the table.
As a general rule, you use SQL management studio (SSMS) to create and run those scripts. So the general accepted approach here is such scripts will not be placed in the front end. As noted such scripts if for some reason must be placed in the front end, then you have to create them as pass-though, but EVEN in this case you want to use the SSMS to create such quires.
So the answer here is you create the new scripts and make table queries in the back end, or in this case using the SQL server management studio.
The syntax checking, query editor etc. in recent versions of SSMS now has auto-complete etc. and you can test/write/update those scripts in SQL server. Once you have such a query or even several of them, then the resulting “several” statements can be pasted into a front end query that been created as pass-though. If you do not use a pass-though query, then you are creating and using and assuming client side SQL (JET (now called ACE)).
The client side has it own version of SQL syntax, and it is NOT 100% compatible with the SERVER SIDE. If you writing SQL in the client that is NOT pass though, then you using a linked table to SQL server. These linked tables thus will use local (JET/ACE) based SQL queries. The ODBC driver thus translates this SQL into server side compatible syntax. However the JET/ACE sql syntax is very limited when compared to SQL server and no server side commands exist in this SQL syntax for the client data engine (JET/ACE)
So for many quires, you will and can simply build such queries using the Access query builder.
However for SQL that needs to run 100% server side then such quires has to be setup as pass-though and are in most cased built + tested using SSMS.

Sql: export database using TSQL

I have database connection to database DB1. The only thing I could do - execute any t-sql statements including using stored procedures. I want to export the specific table (or even the specific rows of specific table) to my local database. As you can read abve, DBs are on diffrent servers meaning no direct connection is possible. Therefore question: Is it possible to write query that returns the other query to execute on local server and get data? Also note, that table contains BLOBs. Thanks.
If you have SQL Server Management Studio, you can use the data import function on your local database to get the data. It works as long as you have Read/Select access on the tables you are trying to copy.
If you have Visual Studio you can use the database tools in there to move data between two servers as long as you can connect to both from your workstation.
Needs Ultimate or Premium though:
http://msdn.microsoft.com/en-us/library/dd193261.aspx
RedGate has some usefull tools too:
http://www.red-gate.com/products/sql-development/sql-compare/features
Maybe you should ask at https://dba.stackexchange.com/ instead.
If you can login to the remote db (where you can only issue t-sql), you may create linked server on your local server to the remote and use it later directly in queries, like:
select * from [LinkedServerName].[DatabaseName].[SchemaName].[TableName]

Exporting Entity-Relationship-Diagram from SQL with Visio 2010 (Professional Plus)

I'm searching the opposite solution to the question exporting SQL from a Viso diagram. I have the SQL statement for the creation of multiple tables of a MySQL database. Is there a way to use the Reverse-Engineering feature of Visio 2010 to create a diagram thereof?
I'm wondering if it is possible to create a Access database from the SQL statement (MySQL) where Visio could connect ... Alternative I'll try to use another MySQL database, create the tables there, and try to connect with Visio to this database. Any instructions how to do this? Other ways?
1) Import SQL into Access and use Visio :
Access is incompatible with MySQL statements. You would have to translate all the statements and only one statement is allowed at the time. Not very convenient. More info at: http://help.lockergnome.com/office2/sql-text-file-import-Access--ftopict720045.html
If you have finished use these instructions:
http://blog.pearltechnology.com/creating-entity-relationship-diagram-in-visio/
2) Create tables again in new MySQL environment and use Visio:
Follow the instructions listed here http://sajjadhossain.com/2009/02/12/reverse-engineering-mysql-database-with-microsoft-visio/comment-page-1/
Problems I had:
Got the error "Host is not allowed to connect to this MySQL server". Use phpmyadmin and go to rights, where you change the host of your user (e.g. to %)
In the instructions above I used in step 12 the "ODBC Generic driver" ( http://maniish.wordpress.com/2007/11/24/reverse-engineer-mysql-in-visio-2007/)
3) Use MySQL Workbench:
Click on Database -> Reverse Engineer
Most convenient but can't decide between option 2 and 3, because of graphical representation and level of detail.
4) Use other software:
http://forums.devshed.com/database-management-46/tool-to-generate-er-diagram-from-sql-code-59569.html