This seems like something so simple but it may not even be possible. I'm very new to SQL but have developed a report that is exporting to an excel spreadsheet. Is there coding that can actually open the excel spreadsheet? I don't mean like link to it or import it. I mean literally open it instead of me fumbling through folders. The coding is in Oracle SQL Developer.
Here's a script in SQLcl that dumps the query results to a csv then opens it.
the same script will work in the SQL Developer worksheet.
The script
turns off headers and feedback.
sets the format of the results to CSV
Spools the results to "users.csv"
Stops spooling
Issues "host open users.csv" which tells the O/S to open the file which should be excel unless the os has csv associated to another application
sql klrice/klrice
SQLcl: Release 18.1 Production on Wed Feb 07 17:28:32 2018
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Last Successful login time: Wed Feb 07 2018 17:28:56 -05:00
Connected to:
Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
SQL> set hea off
SQL> set feed off
SQL> set sqlformat csv
SQL> spool users.csv
SQL> select * from user_objects;
...rows.....
SQL> spool off
SQL> host open users.csv
Related
I created a stored procedure using dynamic SQL and a cursor a while ago. For upkeeping and adjusting purposes, I'm starting to think that standard SQL would be better than having to adjust the cursor. However, to assess this option, I really don't want to go through rewritting all this logic.
Is there a way to see what queries my cursor creates? I realize there is SQL Profiler (which I used very little), however, after a quick search, I saw that it'll simply display "exec my_stored_procedure" instead of showing the entire script.
Are there any ideas?
My SQL Server version: Microsoft SQL Server 2017 (RTM-CU22) (KB4577467) - 14.0.3356.20 (X64) Aug 20 2020 22:33:27 Copyright (C) 2017 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)
Thank you
If your dynamic SQL is built in a variable before being executed, you could just use a PRINT statement to see what the queries are, like PRINT #SQL. Then it would show in your Messages window in SSMS.
I would like to translate Microsoft SQL Server DDL and table load sql commands to the Postgres equivalent.
There are a number of tools to convert one database to another in the link below but are there parsers for ddl/sql script conversion?
https://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL#Microsoft_SQL_Server
During upgrade from PostgreSQL 8.4.8 to PostgreSQL 9.5.2 on Windows OS, i got the following error over command line:
Running in verbose mode
cannot write to log file pg_upgrade_internal.log
Failure, exiting
When I checked the file pg_upgrade_internal.log, it contained following data:
Running in verbose mode
-----------------------------------------------------------------
pg_upgrade run on Tue Apr 24 17:02:13 2018
-----------------------------------------------------------------
Other files like pg_upgrade_server.log , pg_upgrade_utility.log, pg_upgrade_server_start.log, which are generated by pg_upgrade utility, also contain partial data:
-----------------------------------------------------------------
pg_upgrade run on Tue Apr 24 17:02:13 2018
-----------------------------------------------------------------
If pg_upgrade utility failed to write (or in other words, did not have permission), then who wrote the above data ? I am sure that these logs were written by PostgreSQL utility only.
BTW, I have already checked the Stackoverflow, PostgreSQL site links (link1, link2, etc.) which describe the cannot write... error issue, but none of those links mention this issue/concern.
Adding this for reference even though the question is old.
I had the same problem as above and none of the solutions seemed to work.
In my case it seems that the issue was caused by using the machines "Administrator" user with a elevated cmd prompt. I "fixed" the problem by using a normal user, with the correct security permissions on the Postgres data directories.
I have a requirement that am facing difficulty i.e. restoring a data from MS SQL 2012 to MS SQL 2008 using .bak file. when am trying to restore , am getting an error. is this possibility to restore this to downgrade.
can any one help me how to restore ?
Unfortunately SQL Server will not go backwards. The only way you can do this is Using SSIS to transfer the data or you can use the import/export utility.
On your 2012 Server Right click on the DB you want to export data from and scroll down to tasks and then choose export data it will have you then insert all of the information for both the source and destination servers then on the summary page click mappings and make sure they are correct for what you need and the DB it is going to is correct. Then follow the screens until you can click finish. YOu may have too play with it for a little bit to get it to behave nicely but this should work for you.
If all you have is a BAK file you may have to resotre it to a dummy DB on the 2012 server first.
I am a complete newbie to Oracle SQL Developer and I'm trying to make my database accessible remotely. I have a virtualbox setup with my database and I can access it in My Sql Developer through my OS and through my linux image but having trouble getting others to. I think I may not have it configured correctly to allow other users to access it. I have created usernames and passwords but the hostname and port information I either don't have setup correctly or I have the wrong information. Hostname is telling me is localhost.localdomain which doesn't seem right. Any help would be greatly appreciated. Thanks!
The host port needs to be forwarded to the VM's port. Here's the VBoxManage command to do that.
$VBoxManage modifyvm "Oracle Developer Days" --natpf1 "tns,tcp,127.0.0.1,1521,,1521"
Then 'localhost' will work from the host
$ sqlplus system/oracle#//**<<<<hostip address>>>**:1521/orcl
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Sep 24 11:29:03 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select 1 from dual;
1
----------
1
Then it's up to your machine's firewall settings to allow other machines to connect to your host on that port.