How to format SQL code in SequelPro locally? - sequelpro

In SequelPro, there's a built in SQL format bundle. This bundle using a web based SQL format API, hence it requires internet connection. Is there a solution to format code locally?

You can use some script for format SQL like sqlparse.
There are some examples in related issue.

Related

Is it possible to open Firebird database file without installing db server?

I'd like to inspect an existing Firebird (2.5.1) database without having to
install a server.
Are there any tools out there that allow an inspection of the database file?
If not: Are there any tools I can run on the system where the database server
is actually running to take a look at it?
Though it's been a while since I posted this question I'd like to give an answer:
I'm now using "Database .NET" from this website:
http://fishcodelib.com/Database.htm
It works reliably and rock solid (especially when used with large databases).
IBExpert's Database Inside allows you to analyse a Firebird database file directly, without a server. Full description here: http://ibexpert.net/ibe/index.php?n=Doc.DatabaseInside
Yes, you can use the embedded server. Full explanations here : http://www.firebirdsql.org/manual/ufb-cs-embedded.html

Convert MS Access 2010 query to SQLite query

I have a query in MS Access database. I want to run this query in SQLite database. I wondering whether there is a easy way to convert the code or just change step by step?
You have several options available for viewing the contents of a sqlite database and running queries against it. When building sqlite from source you can choose to build the shell utility.
If you want something more turnkey you can install a free tool such as Sqlite Manager for Firefox or Sqlite Browser.
In both apps you can copy-and-paste your SQL that you want to execute against a SQLITE database file. Good luck!

Exporting SQL Server data (fixed length) to an SFTP server on a daily basis

Hey guys, I do most of my work in MySQL, but have recently been tasked to do some database work on SQL Server. I realize the databases work in a very similar fashion.
My task is simple, export data from a SQL Server 2008 database as a fixed length file to a secure ftp server on a daily basis.
If I was using php I would probably just write a php script that does this with a cron job. But in this case, I dont have access to any of that. From what I read it seems like I can use SQL Server 2008 itself to do this for me.
Can anyone give any pointers and let me know if this is an easy task. I don't want to take on a job that is beyond my skill set ;)
Every SQL Server installation (including Express editions) comes with little tool called bcp.exe (Bulk Copy utility). It supports two formats, native and character. You are probably interested in the character format, see Using Character Format to Import or Export Data. Adding a comma , field terminator will produce a CSV file:
bcp database.dbo.table out datafile.csv -c -t, -T
If you want a fixed length output, then probably the best solution is to specify a format file. See Specifying Data Formats for Compatibility by Using bcp.
Once you have the file, you can copy it to your SFTP server. The equivalent of cron on Windows platforms is the Scheduler, see The Task Scheduler.
There are more fancier solutions, like using SSIS as Eugene suggested, which would give you more power and control. SSIS comes with SQL Server (but not with Express Edition) and on non-Express Editions you have the SQL Server Agent to help you schedule tasks.
If you can use SQL Server Integration Services, take a look at SFTP task in our BizCrypto product. With integration services you can build a file and transfer it to the remote SFTP server.

How Do You Save An Image Out of a SQL Database Into the File System Using only SQL?

Similar to this question only the other way of flow.
Insert Picture into SQL Server 2005 Image Field using only SQL
I need to be able to save a image field out into the file system and be able to name the file with only using SQL. I don't want to use TEXTCOPY either because I need to use the connection to the database that is running the query itself.
I'd like this to work in SQL 2005 to support older database clients but if it's available in only 2008 that's fine.
Any ideas?
With SQL 2k8 there is the new FILESTREAM type that covers such cases. Filestreams can be opened via the Win32 file access handle like any other file, but hey are integrated into the database from transaction and backup/restore point of view.
I had a similar issue in SQL 2k5 and my solution was to use a CLR stored procedure with EXTERNAL_ACCESS that was writing into the file system using C# file operations.
I don't believe there is a way to save out using only sql, but there is a command-line utility, bcp.

Importing data to MySQL from MS SQL

I want to import data from MS SQL Server, run it through some sort of regexp to filter out stuff, and import it into MySQL. I then, for each query, wish to display a relevant image from a third database. What would be the easiest way to do this, importing and linking wise?
Thank you.
Clarification: It is a php application to filter data from another database, and then for each record show an associated image from a 3rd database. It is from scratch...
You can try the MySQL Migration Toolkit.
http://dev.mysql.com/downloads/gui-tools/5.0.html
Now archived at http://downloads.mysql.com/archives.php?p=mysql-migration-toolkit
use SQL Management Studio (or Enterprise Manager depending on version) with the SQL Server import wizerd to get it into MS SQL.
From there you can export it to Mysql using the MySQL connector drivers.
As for as displaying an image from a third database, that is completely up to the code you have written in your application.
I would use the Microsoft SQL Server Data Publishing Wizard (free). You can use it to script your entire database (including insert statements.) You'll have to edit this script a little bit probably to get it to run in MySQL. Now you just have a regex problem. You can try:
Manipulating the data in MS SQL via a query, or from code (using regex) the transfer.
Running your regexes on the script file itself, maybe try some macros, find and replace, etc.
Manipulating the data in MySQL via a query, or from code (using regex) after the transfer.