ssis importing to an other server - excel

There is a SSIS project which takes data from oracle table and export that into xls file.But before exporting there are File System Task and Execute SQL Task which are supposed to delete xls file and after that create it again. The project looks like on images:
it perfectly works on a lochalhost. But the task is to export a file to other server. Excel file path for "Excel connection manager" is
C:\Users\YIskende\Desktop\New folder\report.xlsx
but how to change that in such a way to make it work with an external server

2 solutions (it depends also from SSIS and SQL Server version)
1) Package Deployment Mode: If you use a package configuration (old SSIS and SQL Server versions), you can create a Configuration database on your server where to store paths and variable values (Menu: SSIS -> Package Configurations)
2) Project Deployment Mode: In SQL Server 2014 version you have a Integration Services Catalogs in SQL Management Studio where deploy your project and save your values

Related

Empty file is created when running SSIS package from SQL Agent; File create not part of script

SSIS package created in VS 2019.
Imports Excel file; fails if file not found.
Runs fine from SSIS.
When triggered from SQL Server Agent (SSMS 18.8) an empty excel file is created, with a random hex sheet name. The job fails.
Has anyone experienced this? Any idea how to resolve??

Is there Support .sql File in SharePoint?

I uploaded .sql file in sharepoint. Unfortunately; there is only a download option if I want to view it. Is there a way to maintain such files in Sharepoint other than in .txt file?
As I understand, .sql is struct Query Language Data file,so SharePoint not provide the default program to open .sql file.
If you are using MS SQL Server Database, you could download and install SQL Server Management Shell which supported to open .sql file:
Download SQL Server Management Studio (SSMS)

Writing a flat file in SSIS succeeds if run from VisualStudio, fails if run from the Integration Services Catalog

I have an SSIS package that does a Bulk Insert, then executes a SQL Task, and then finally writes some database data to a flat file on our network. The package runs fine if I run it from Visual Studio 2012. However, if I deploy the package to the Integration Services Catalog on a 2012 SQL Server and run it from there, the Bulk Insert and SQL Task run fine, but when the package tries to output to the flat file, I get these error messages:
Cannot open the datafile "\\nyfil006\Projects\Accounting\CostRecovery\Cafe de Novo\HospitalityCharges.csv".
HospitalityCharges Flat File failed the pre-execute phase and returned error code 0xC020200E.
I'm able to output the System::UserName to an errorlog, and it's what I think it should be: an account that has full permissions to the folder in the flat file destination (and its parent folders). I've tried creating a blank version of HospitalityCharges.csv, and DelayValidation is set to True for the Data Flow Task that outputs the flat file. My system admin has granted Network Service permissions to the folder as per this link and this link, but that doesn't help. I've also made the connection string an expression as described here. We've also created a mapped drive and used that for the Destination Connection String instead of a UNC path. No joy. Does anyone know why this is happening?
Another note: if I change the flat file destination to point to the C: drive, the package runs fine, whether I run it from Visual Studio or from the Integration Services Catalog.

How to connect to SQL database from Visual Studio/ open .mdf file

If I copy an .mdf file created by SQL server management studio and put it in the app_data folder I get this error:
"This database file is not compatible with the current instance of SQL Server.
To resolve this issue, you must upgrade the database file by creating a new data connection, or you must modify the existing connection to this database file.
For more information, see http://go.microsoft.com/fwlink/?LinkId=235986"
And if I attempt to Add connection using the visual studio wizard, choosing the Microsoft SQL server database file and select the file I get this error:
"
Unable to open physical file "path" {access is denied) an attempt to attach an auto named for file "path" a database with the same name exists, or specified file cannot be opened, or it is located on UNC share"
And if I attempt to add a connection choosing the "Microsoft SQL server" option in the choose data source window:
"a network related or instance specific error occurred while establishing a connection to SQL server. the server was not found or was not accessible. Verify the the instance name is correct and that the SQL is configured to allow remote connections..."
The only reason I want to connect visual studio to the database is because VS doesn't allow me to import text files. I have imported a text file into a DB from SQL server management studio and I want to connect it to VS. I've turned off UAC in windows 7 and I have file permissions to the mdf file.
Old question, but just to provide an answer for visitors from Google, the problem is not related to file system access (although Administrator accounts should have full privileges to the folder containing the mdf and log files). The solution is that SQL Management Studio needs to be opened using "Run As Administrator". The elevated permissions will allow SQL Server (or SQLExpress) to attach the older mdf file and update it. Once the db is attached, you can access it in Visual Studio by adding a database connection through the Add New Item->Data->ADO.NET Entity Data Model wizard.

Azure SQL Database Bacpac Local Restore

I've created a BACPAC backup of my Azure SQL Database using the "Export" option within the Azure Management Console.
Having downloaded this to my machine I'm a little stuck on how I can restore this to a local SQL Server instance. I came across the DacImportExportCli tool but couldn't find an example of a local restore.
Also if anyone has written a script that does this (so it can be scheduled) that would be awesome.
This can be done simply through SQL Server Management Studio 2012
Right click on the Connection > Databases node and select "Import Data-tier application..."
Select "Next" on the introduction step.
Browse, or connect to a storage account where backups are kept.
Try "SqlPackage.exe"
I needed to export a SQL Azure database and then import it into a local SQL 2008 R2 server (Note I am also using Visual Studio 2010). Microsoft certainly went out of their way to make this a painful task, however, I was able to do it by doing the following:
Go to this link http://msdn.microsoft.com/en-us/jj650014 and install the SQL Server Data Tools for Visual Studio 2010
This will install on your local drive. In my case here is where it put it: C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin
Browse to this via the command line or powershell
You are going to want to execute the SqlPackage.exe
Open up this link to see a list of all the parameter options for SqlPackage.exe (http://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx)
Here is my command line that I needed to execute to import a .bacpac file into my local SQL 2008 R2 server:
.\SqlPackage.exe /a:Import /sf:C:\mydatabasefile.bacpac /tdn:NorthWind /tsn:BINGBONG
/tdn is the name of the database you want your bacpac file to restore to.
/tsn is the name of your SQL server.
You can see all these parameter descriptions on the link from #5.
You can restore the BACPAC by using the client side tools. Videos are here:
http://dacguy.wordpress.com/2011/09/09/importexport-services/
The tools are available here:
http://sqldacexamples.codeplex.com/documentation
Seems my prayers were answered. Redgate launched their SQL Azure Backup tool for FREE today - http://www.red-gate.com/products/dba/sql-azure-backup/download
If you're using SSMS 2012, it is as easy as right-clicking on the Databases folder under a server in the Object Explorer and choosing "Import Data-tier Application...".
There is one bump in the road to watch out for: as of Mar 26 2013 (when I needed to find out how to do this myself), when you export a .bacpac from Azure, it will be downloaded as a .zip file, not a .bacpac file, and the file dialog that is opened by the Browse button in the import wizard will only show either *.bacpac or *.* in the file filters, implying that .zip is not supported. However, if you change the filter to *.*, select your downloaded .zip, and click Next, the wizard will proceed normally.
Here's a script to restore a bunch of bacpac files at once:
Bulk Restore bacpac files local
cd [FOLDERPATH]
$goodlist = dir
cd 'C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin'
foreach($i in $goodlist){
$name = $i.Name;
$namer = $i.Name.Substring(0, $i.Name.length - 7);
.\SqlPackage.exe /a:Import /sf:[FOLDERPATH]\$name /tdn:$namer /tsn:[SERVERNAME]
}

Resources