Retrieve XML Code by API with Automatic Approach - sql

Goal:
Retrieve a XML list from Internet, using API connection, and transfer the data into a sql server's table automatic using Scheduling tool with SQ server agent and its jobs.
Problem:
I have two questions:
What component in SSIS do I need to retrieve the XML file, using API connection?
Is it possible to use stored procedure, code that retrieve and transform the xml file and its data, to transfer it into a table? In This context, no usage of SSIS.
Information:
*The computers version is SQL 2008 R2 standard edition.

If everything is straightforward, I would use Web Service Task. If not, use the Script Task and take care of API Connection in C# code. See this link.
Yes. to avoid SSIS, you need to create a CLR Stored Procedure. See this link.

Related

How to write a query procedure that can be send to other local machines?(Beginner)

I have the database, tables, PK's and FK's, i need to send it to the other local machine, i tried writing some query's but it failed.
(Please be polite, just started :) )
You need to be more clear on your actual goal, the question is very vague. If you are trying to transfer data from one data base to another database, which is what I assume you mean, I would highly recommend using SQL server Integration Services. You create SSIS packages in Visual Studio and it will allow you to write simple queries from your data source and insert them into the tables of the destination database. You will need to download Visual Studio and install the integration services add on. Hope this helps.

MS Project data in SQL Server

I have been given the task to Load all our company's project data from MS Project into SQL Server to be able to create reports and dashboards from the project data.
I know you can export a specific projects data into a access database, but every project must have it's own access database. So my first thoughts was to create some kind of dynamic access SSIS connector and ETL. So that the project managers export their projects to access and the SSIS package takes care of the rest.
Is there a simpler way of doing this?
My company also have a SharePoint infrastructure as well as SAP BusinessObjects infrastructure. Is there a way I can accomplish this by the use of SharePoint or bobj
The simplest but costy way is called MS Project Server - it stores all data in MS SQL database already, has precalculated reporting database and so on. Here is a link http://technet.microsoft.com/en-us/evalcenter/hh973404.aspx. The last version can be either installed locally or hosted by Microsoft.
Another option I see is to use kind of automation around MS Project which will load project plan, extract all interested information and upload to to your database. There is no big magic in this solution.
The third option is to export projects to XML and then use the XML to upload data to SQL Server database. This solution is also doable through Project automation
After defining your database and column structure in SQL Server, just use Project VBA to A) collect the project and task data into an array, B) set a connection string to your database, then C) send it. I have created several applications around this procedure and it works very well.

Is it possible to monitor and log actual queries made against an Access MDB?

Is it possible to monitor what is happening to an Access MDB (ie. what SQL queries are being executed against it), in the same way as you would use SQL Profiler for the SQL Server?
I need logs of actual queries being called.
The answer depend on the technology used from the client which use MDB. There are different tracing settings which you can configure in HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\4.0\Engines\ODBC http://office.microsoft.com/en-us/access/HP010321641033.aspx. If you use OLEDB to access MDB from SQL Server you can use DBCC TRACEON (see http://msdn.microsoft.com/en-us/library/ms187329.aspx). I can continue, but before all you should exactly define which interface you use to access MDB.
MDB is a file without any active components, so the tracing can makes not MDB itself, but the DB interface only.
UPDATED: Because use use DAO (Jet Engine) and OLE DB from VB I recommend you create JETSHOWPLAN regisry key with the "ON" value under HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\JET\4.0\Engines\Debug (Debug subkey you have to create). This key described for example in https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-5064388.html, http://msdn.microsoft.com/en-us/library/aa188211%28office.10%29.aspx and corresponds to http://support.microsoft.com/kb/252883/en allow trace OLE DB queries. If this output will be not enough for you you can additionally use TraceSQLMode and TraceODBCAPI from HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\4.0\Engines\ODBC. In my practice JETSHOWPLAN gives perfect information for me. See also SHOWPLAN commend.
UPDATED 2: For more recent version of Access (like Access 2007) use key like HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0\Access Connectivity Engine\Engines. The tool ShowplanCapturer (see http://www.mosstools.de/index.php?option=com_content&view=article&id=54&Item%20%20id=57, to download http://www.mosstools.de/download/showplan_v9.zip also in english) can be also helpful for you.
If you're accessing it via ODBC, you can turn on ODBC logging. It will slow things down a lot, though. And it won't work for any other data interface.
Another thought is using Jet/ACE as a linked server in SQL Server, and then using SQL Profiler. But that's going to tell you the SQL that SQL Server processed, not what Jet/ACE processed. It may be sufficient for your purposes, but I don't think it would be a good diagnostic for Jet/ACE.
EDIT:
In a comment, the original poster has provided this rather crucial information:
The application I am trying to monitor
is compiled and at a customer's
premises. I am trying to monitor what
queries it is attempting against an
MDB. I cannot modify the application.
I am trying to do what SQL Profiler
would do for a SQL Server.
In that case, I think that you could do this:
rename the original MDB to something else.
use a SQL Server linked server to connect to the renamed MDB file.
create a new MDB with the name of the original MDB and link to the SQL Server with ODBC.
The result will be an MDB file that has the same tables in it as the original, but they are not local, but links to the SQL Server. In that case, all access will be going through the SQL Server and can be viewed with SQL Profiler.
I don't have a clue what this would do to performance, or if it would break any of the data retrieval in the original app. If that app uses table-type recordsets or SEEK, then, yes, it will break. But this is the only way I can see to get logging.
It shouldn't be surprising that there is no logging for Jet/ACE, given that there is no single server process managing access to the data store.
Keep in mind that the file sitting on your hard drive is simply a windows file. So, there is a big difference between a server based system and that of a simple text file, or Power Point file, or in this case a mdb file just sitting on the drive.
However you can get the jet engine to display its query optimizeing via showplan.
How to do this is explained here:
http://www.databasejournal.com/features/msaccess/article.php/3658041/Queries-On-Steroids--Part-IV.htm
The above article also shows how to access the jet disk read statistics, which I also find extremely useful for optimizing things.
Just remember to turn off that data engine logging system when you’re not using it as it creates huge log files…
you could write your own profiler, based on a "transaction" object that will centralize all instructions sent to the database, You'll end up somewhere with a "transaction.execute" method, and a transaction table in your access db. This table can then be used to collect transaction's instructions, start time, end time, user sending the instruction, etc.
I'd suggest upsizing the tables to SQL Server. There is a tool from the SQL Server group that is better than the Upsizing Wizard that is included with Access.
SQL Server Migration Assistant for Access (SSMA Access)
Also see my Random Thoughts on SQL Server Upsizing from Microsoft Access Tips page

create pdf files in sql server

All of our correspondence is done via database mail in sql server. The data for document generation and the rules to trigger the generation are all on sql server. We now have to create a pdf file. I was planning on using pdfsharp/migradoc to do it, but then we'd have to create document and time its readiness with sql server data state and mail state. It'd be nice if the db could handle everything.
Has anyone created pdf files directly in sql server? And if so, how.
take a look here: Create data driven PDF on the fly by using SQL server reporting service (SSRS)
I've not used it, but there is SQL2PDF stored proc. It uses sp_OA% code.
Google search
Blog article and duplicated on SQL Server Central (needs login)
SQL isn't the best place to do this of course, but if you have to I'd use CLR if possible.

How Do You Save An Image Out of a SQL Database Into the File System Using only SQL?

Similar to this question only the other way of flow.
Insert Picture into SQL Server 2005 Image Field using only SQL
I need to be able to save a image field out into the file system and be able to name the file with only using SQL. I don't want to use TEXTCOPY either because I need to use the connection to the database that is running the query itself.
I'd like this to work in SQL 2005 to support older database clients but if it's available in only 2008 that's fine.
Any ideas?
With SQL 2k8 there is the new FILESTREAM type that covers such cases. Filestreams can be opened via the Win32 file access handle like any other file, but hey are integrated into the database from transaction and backup/restore point of view.
I had a similar issue in SQL 2k5 and my solution was to use a CLR stored procedure with EXTERNAL_ACCESS that was writing into the file system using C# file operations.
I don't believe there is a way to save out using only sql, but there is a command-line utility, bcp.