Exporting password protected file from sql - file

How can I export my MSSQL table into a password protected excel file? I am mentioning that I need to export my table into excel not importing.

Export the MSSQL data into excel by following the steps mentioned here
Export SQL server data to Excel and then add a password to your generated excel using the steps mentioned in this article Protect Excel with a Password

Related

SQL Server export wizard is changing all the data to nvarchar

I am trying to export data from SQL Server to Excel and then upload that data into another SQL Server instance.
While the export looks like it's working - no errors or warnings - I get an Excel file where all the data is "general" format.
When uploading the Excel to the new server, all columns are of type nvarchar, no dates floats int etc.
Does anyone have an idea why this is happening?

Workaround for exporting data to Excel with more than 255 columns

SSMS and SSRS to Excel enable for more than 255 columns when copy-pasting.
SSIS does not allow for more than 255 columns to be exported to Excel 2007.
Is there a way to override this?
Problem
There are a lot of Limitations when exporting to an Excel Files using Sql server data tools
Workarounds
You can do some workaround to achieve this:
Create a dataflowtask that export your data into a FlatFile (csv)
Store your Destination FileName in a Variable
Create another Dataflowtask that convert your csv file to an Excel File using a script task with a similar Function
Note: you have to add Microsoft.Office.Interop.Excel.dll file to the following directories (.Net Framework dll directory) C:\Windows\Microsoft.NET\Framework\v2.0.50727 and (sql server data tools dll directory) C:\Program Files\Microsoft SQL Server\100\DTS\Binn (using vs 2005 and sql 2008) and then add this dll as a reference in your script task
Imports Microsoft.Office.Interop
Public Sub ConvertCSVToExcel(Fromcsv As String, Toxlsx As String)
Dim Exl As New Excel.Application()
Try
Dim wb1 As Excel.Workbook = Exl.Workbooks.Open(Fromcsv, Format:=4)
wb1.SaveAs(Toxlsx, FileFormat:=XlFileFormat.xlOpenXMLWorkbook)
wb1.Close()
Exl.Quit()
Catch ex As Exception
Exl.DisplayAlerts = False
Exl.Quit()
End Try
End Sub
Third party components
Or you have to use a third party components like cozyRoc SSIS+
Side Note
if you are looking to Import data from excel with more than 255 columns you can follow this Link
References
Third party components
SSIS: Export more than 255 columns from SQL table to Exce
Cozyroc website
Workaround
convert csv to xlsx
trying to use custom assembly with script task in SSIS 2008 - can't find correct version of GACUtil
Refer the link. Best would be to create an script in SSIS to copy the content as csv format. You can use c# or VB.Net.
just for anyone come to this page and use SQL Server Import and Export Wizard to export to excel
in tab Review Data Type Mapping
section Data Type Mapping: ==> double click your column that has length more than 255 char open its Column Conversion Details Dialog then close it
then next to end...Lool

How to Import/load password protected excel work book to tables using SSIS?

I have an excel file and I have to load the excel data into SQL tables through an SSIS package.
I have tried creating a package and added excel connection manager and excel source but the excel is showing up an error and name of the excel sheet in the drop down is not loading...
Please help. Let me know if you need any further information. Thanks!
Apparently it is not possible to connect to a pw protected excel file even though there is that property:
https://msdn.microsoft.com/en-us/library/ms139836.aspx
I did find a workaround though using powershell to open and save as...
http://www.sqlservercentral.com/Forums/Topic885800-148-1.aspx

Export SQL Server table to Microsoft Excel xlsx file

I have to replace a VB6 function that allows to export a SQL Server table in a xls file using DAO.
In order to use Excel 2007-2010... files (xlsx), I tried to use this function to do that but it doesn't work.
Here is the DAO functionnality :
//Opening the SQLServer database with DAO
Set oBase= DBEngine.OpenDatabase(DSNName, dbDriverNoPrompt, False, "ODBC,PROVIDER=Microsoft.JET.OLEDB.3.51;DSN=DSNName;UID=user;PWD=pwd;DATABASE=SQLServerBDDName;Server=SQLServerName;")
//Query to export data
oBase.Execute("SELECT * INTO [SheetName] IN 'xlsFileName' 'Microsoft Excel 8.0;' FROM [SQLServerTableName]")
This function works perfectly with 97-2003 Excel files in xls but not with xlsx files.
Is there a possibility to make the same thing with ADO but without OPENROWSET statements or stored procedures ?
Thanks for your help
I finally found how to make in VB6 SQL Server export to Excel 2007 file with ADO and WITHOUT Office installed.
First, I use ADO to create xlsx file :
Dim l_oBase As New ADODB.connection
l_oBase.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\myExcelFile.xlsx;Extended Properties=""Excel 12.0 Xml"""
Call l_oBase.Open
Then I execute a query to export a table in a sheet by using ODBC connection and DSN to connect to SQL Server database :
l_sReq = "SELECT * INTO [mySheet] FROM [ODBC;DSN=MyDSN;UID=LoginSQL;PWD=pwdSQL;Server=MySQLServer;Database=myDatabase].[TableName];"
Call l_oBase.Execute(l_sReq)
Call l_oBase.Close
When I execute the query in debug mode, I obtain an error on execute but xlsx file is correctly created and populated with data formats.

SQL Server: how to export a table

how can I export a SQL Server table to Mysql ? I guess I need to export a .sql file compatible...
thanks
Solution: Right Click on database Icon > Tasks > Generate Scripts
follow istructions and export a specific table as .cvs
One way is to BCP the data out into a CSV or some other format flat file and import those into mySQL.
Another way is to use a SSMS add-in called SSMS Tools Pack which has the option to generate insert statements.
please see the below link, maybe it can help you.
MSSQL to MySQL

Resources