Create XLS file using TSQL - sql

I need to generate XLS file using TSQL only. I am generating XML based Excel.
I am trying to use FOR XML for this but as the output XLS file is fairly complex its taking much efforts and time.
Is there any other way to do it?
Or if its only way what's that can i do to do it effectively ?
It is not about exporting the data. I will respond to the user in XML format and that XML format will be opened by Excel(I will include headers that Excel know and will open the result in Excel.) User or I will not have direct access to SQL server so no way to export the results.The query will be exposed as Web-service. User will request the data and application will respond with XML that will be opened in Excel.

Related

How do i convert a csv file to a db REACT-NATIVE

I am trying to create an app that pulls and pushes to and from a remote server a bunch CSV and a txt file with data in it and convert it into a SQLLite database that I can read/write/query. The txt file contains timestamps that I will be using so when the app pulls again from the server it'll take only the updated values from the server after that certain timestamp (so I don't have to completely redownload all the data). However, I also want to be able to send data back to the server from the database!
So far, I have successfully implemented the Fetching of the data but I am stuck on how to convert my csv files into a db file for React-Native. I want to use react-native-sqlite-storage to then read/write/query the data.
However, the react-native-sqlite-storage requires a .db file and I only have .csv files.
I was thinking that I could convert the csv file into a JSON and then somehow convert the json into a db?
I'm confused whether or not my approach is efficient or is there any other efficient way to implement this ! Thank you so much

what format is most reliable for saving a history file from an application?

Good Afternoon,
I am in the process of developing in vb.net a simple “cheque printing” application which will allow users to fill in a few text boxes with the values that will be printed on a cheque.
When they hit the print button, the values will be sent to the printer, but I also want the values they input in the text boxes saved to a file, so like a history file of all the cheques that were created.
I am thinking to use either an access database or an excel spreadsheet as my history file, but I am not quite sure on which would be best.
Please note that in my environment storing this information in a SQL database is not an option and also this file will most likely be stored/accessed from the network.
The history file needs to be:
1.Stable (cannot corrupt easy)
2.Reliable
3.Easily exportable in case we need to export the information to one of our in-house systems.
4.editable from the application I am developing
Kindly advise,
A
XML. Save the data to DataTable object and then use the .WriteXML method to save it as an xml file. I'd advise creating a strongly-typed DataTable class for this, so that the XML can be exported with a reliable schema and imported easily.
If you are using different fonts, you could use a .rtf (rich text format) which will save the format of the text that you send to print... it is a universal file format, you can open it with open office, ms office, or any office suite you have...
Access will be best choice,
it's relational database and can make a form from this file to do what are you looking for without VB or any code.
Also you can access this file from network.
for more detail about setting for this file go to this link
http://goo.gl/bOfGp6
and you will find more options complete your work.
I would use a MySQL server. It's free.
XML is also good, but I hate sharing folders...

saving data from an online table/CSV to sql database

I am looking into creating an sql database that extracts data from a web page. The webpage displays the data in either a table or CSV list.
The address of the page is
Online table/CSV
I am not entirely sure how to do this. I thought maybe to save the page as a text file then import it but I cannot save it. Am I missing something is there an easy way of doing this?
Apologies I should say that I will use the data in a asp.net application using VB in Visual Studio 2010. The SQL will will be SQL Server 2012.
EDIT - ok so I was informed to run the page in compatibility mode and the CSV will save which I have confirmed. I therefore need to be able to open the page using a vb console app and perform a save as. I have tried using the webclient control and I can create a file but it downloads the html of the page as well. How do I save the contents of the webpage as a csv or text file?

Create an excel output file from Biztalk as resulting of a query from SQL

I have a query in SQL Server that returns me 5 columns with some data.
I want to create a BizTalk application that saves me the result of my query in an Excel file.
I will create a SP for polling, using wcf adapter to do the communication between BT and SQL.
I don't know how to generate a file.xls. Is it possible?
Thanks
Any .xls file can be saved as a XML Workbook ( File-Save As from Excel), which is an XML document. You can see that this an XML doc you open it in notepad.
Now, the trick is to get hands on the schema used for generating this, which is perhaps proprietary for microsoft and may not be given out. So, the workaround is, if your excel file is failrly simple, you can save it as the Workbook and see the XML and generate an XSD based on it.
Now, map your incoming XML to this Workbook XSD and the resultant XML will open directly in Excel, when you double-click on it.
Hope this helps.
in that case you need to developed a custom pipeline
biztalk-custom-excel-pipeline-component

How to edit a Word Document (.docx) stored in a SQL Server Table?

How to edit a Word Document (.docx) stored in a SQL Server Table?
Here is the tentative work flow:
Read BLOB from SQL Table through Ideablade
Write BLOB to disk as .docx
Open .docx using Word
User makes changes
Save .docx using Word
Read .docx into BLOB
Write BLOB back to SQL Table through Ideablade
All sample code is welcomed?
I am sure there are a lot of people doing this already.
Any other ideas on how to simplify this process?
I am using VB.NET, .NET 3.5 SP1, WinForm and SQL Server 2008.
Well, as to the how, here is how to read a blob and write a blob to SQL. Although frankly, unless you have very good reasons such as an existing backup system, you would probably be best served storing the file to the file system and the path and metadata in the database. Either way, abstract it in your BLL, so you can change your mind down the road.
Retrieving and updating the BLOB from the db shouldn't be a problem, you'll find lots of sample code to do that on the net.
A simple approach to your problem would be to create a "temp" or "working" directory somewhere and monitor it with System.IO.FileSystemWatcher (sample code). When the user wants to edit a file, fetch it from the db and store it the directory. Whenever the user saves the file, you'll get a notification from your FileSystemWatcher, so you can save it to the database. Don't forget to empty the directory from time to time.
The method I've seen for this that I think works best is to build this as an add-on for MS Word itself. Examples include the Save to Sharepoint, Save to Moodle, and other similar add-ins.