SQL Server Management Studio always appends $ to table name when importing from Excel - excel

I've noticed that whenever I try to import data from an Excel file, the Server Management Studio importer will append a $ to the name. I'm not sure why this is, but it is awkward because then you end up with tables like table$ instead of the table you want it imported to.
Does anyone know why this happens and how to avoid it?
Thanks in advance,

Related

How do I create a file from a result set?

I'm using Oracle 11g
I'm trying to create a flat file (CSV or TXT) from a result set but am struggling on where to even start. It seems like I have to create a stored proc and use UTL_FILE. After doing some research, I have two questions:
Where does the file get created? According to this question I need to get access to the Oracle user directory, but where is that on a Windows and Linux environment? I have to test on Windows , and the script will eventually be on a Linux environment.
What would be the basic format of a SQL script to create the aforementioned file, and load data into it from a fairly basic SELECT query? I'm not seeing a UTL_FILE function to write the records to the file; do I have to iterate through the entire result set and use PUT or can I somehow just push the entire result to a file?
I think using "spool" can do the trick.
Check this out https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9518534700346581975
And more information is here http://www.dba-oracle.com/t_sqlplus_spool.htm
The file will get created in the directory where you launch sqlplus from.
If you're using SQL Developer you can create a view for your query. Right click view in schema browser and choose export and export as csv.
But personally I would go for spool as previous answer said. SQL Plus is most basic client so I don't believe you won't have it.

Automation - Replace Connection Properties on Excel

I'm currently working on maintaining some old (new format .xlsx) excels with more than 60+ connections each that feed some various tables from a SqlServer.
I'm in search of some kind of toolkit, module, standalone script (or anything really) that let me bulk change the command text inside each connection properties.
The change should be not harder than changing part of the table name as the new table only contains the information that the table needs.
So far, the only thing that gets near what I need are those python modules but they don't appear to implement anything for handling connections.
Thank you in advance for any help you can provide.

Update database with visual studio database projects

Hy,
I'am trying to use Visual Studio 2012 database project to upgrade a database to a newer version but i'am having a weird problem.I select the source database then the target database and hit compare.Visual Studio generates the script with the differences and when i execute it fails because it tries to drop tables without first dropping the FK constraints that are on those tables.(normally it should first script all the constrains from a table,drop them,drop the table,after that create the new table and finally recreating the constraints)
Do you have any ideas why it tries to do directly drop table without dropping constraints first.
Am i missing some settings?
Sounds like a bug to me. Try posting the same question on the SSDT forum.
If you have access to a copy of SQL Compare, it might be worth trying the same comparison to see if this works better. If you're using a database project as a data source, you'll need to select "source control", then "scripts folder", and browse to the folder that contains the .sqlproj file. Here at Red Gate we're working on improving database project support in SQL Compare so we'd welcome any feedback or questions.
If the tables that are being dropped in your database are not in your schema definition and you have got the "DROP objects in target but not in project" option selected in the Deployment Options, then it will try to drop them.
Have you checked this is not the case?
Whenever i work with database generating code from data models, or scrips, i often get that problem, so i have an script just for deleting those keys, sometimes i have to drop my database manually rather than executing the query, because most of the times it does but not completely, so i first dro the database, generate the script and run the script just for erasing the keys

ssis excel source cannot acquire connection manager at DESIGN time

I have an SSIS (super)package that consists of several (about) 40 packages, each of which has several data flow tasks, most of them loading some excel data to a sqlserver database. So I have several excel source connection managers, one per excel file.
This has always worked fine until recently : I have to change an excel source in one of my packages (a column was added in the excel which has to be loaded in the destination sqlserver table) but I cannot edit the excel source in SSIS : when I click on "columns" I get an error box "DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER". So this is a design time issue, not a run time problem. I've seen a question like this one on stackoverflow but no answer. Anyone has an idea ?
I' ve already removed office 2007 and reinstalled office 2003 on my machine, but this didn't help
it has nothing to do with 64bit mode, which I've read about here
Is there some limit on the number of connection managers in ssis ?
Most of my connection managers were created with copy/paste and hence they have the same Id, although they point to different excel files. Could this be a problem ?
I should also mention that the package runs without any problems, so it's only "editing/changing" the package that doesn't work. For the moment I circumvent this problem by disabling the data flow that should change and by replacing it with a sql statement that hardcoded inserts the data from the excel into the destination table.
Maybe another intersting thing to mention : I can create a new package and add and change excel sources without problems, but then again, when I try to copy this excel source in my package, I cannot edit it.
Did you try to check the advanced options on the Source Connection?
Right click on the component and select "Show Advanced Editor..."
Select the column mappings tab and press the Refresh button.
This should point out that the XLS connection has some additional columns or that the file that you are pointing at, cannot be pre-validated at runtime.
M.
I'm not sure if this will work but try the Work Offline option in the SSIS menu in BIDS/VS. What this should do is not validate the connection before you edit the component. It might be able to get you into the component.

How to update report in access with bound dataset automatically?

I have a single entry output from a paradox table which is imported into Access. Now I have created a report and done the databinding within the report to the dataset from Paradox. When work is done in Paradox the single entry output changes...
How do I open up access and have the values from the report update automatically without having to reimport the table manually?
The objective is that when access is opened the report comes up immediately for inspection before printing.
Use a linked table instead of importing the data (assumes a provider for paradox is available, which seems likely).
Linking directly to the Paradox table should work. The way to do what you asked, automating the import, would be to run DoCmd.TransferDatabase in either an autoexec macro or in the OnLoad event of your report. You would probably want to start with a delete query to reset the table too.
Link table to Paradox file through GetData on menu. You select the file from the route directory where your db files are and select. Maintain a link and bind the date relationships to the dataset. As you update using the Paradox database the tables in Access will update also. You musn't run the db and access the same time otherwise jet engine won't work.
From the design view of the report, go to the property sheet and the Event tab. Find the On Load event and click the elipsis button. Select Code Builder if presented with the Choose Builder dialog. This will drop you into the VBA editor in the Report_Load event. Edit to look something like this:
Private Sub Report_Load()
DoCmd.TransferDatabase acImport, "Paradox 7.x", "c:\yourdata\yourfile.tbl", acTable, "SourceTable", "YourAccessTable"
End Sub
I'm not sure on the specifics for the Paradox version, the file naming convention, etc. (I only dabbled with Paradox briefly and don't remember it's specifics). Watch the intellisense or put the cursor on TransferData and press F1 to get the Help for the TransferDatabase method for reference.
Ahead of the TrasferDatabase statement you might want to run something like:
CurrentDb.Execute "DELETE FROM TableName"
That will blow out the destination table on the Access side ahead of the load from the Paradox side.

Resources