I tried using the text dll but i'm getting this message"
Unable to find consistent column separator in header row
I viewed their sample file but its not clear how to create and insert values in the database
Is it k to copy our create code in text dll box...
can any one help me....
I have found that when getting data out of SQL server, if you have any kind of convert or cast functions in your select statement and don't specify a column name then this error is triggered when pasting data into SQL fiddle text to DDL. (No column name) will show up unless you alias your column name after the convert/cast by using:
AS 'Your Column Name'
Example:
CONVERT(date, Dt_Approv) AS Dt_Approv
This gets rid of the (No column name) in the DDL that causes the error. It is at least something to try, it worked for me.
EDIT:
Not sure if I answered you the way you were hoping. To use the text to DDL tool on SQL Fiddle, all you have to do is paste in the tabular data from your databse or spreadsheet. From that the program will build the DDL, hence text to DDL :)
No need for create or insert statements when using text to DDL, it will write them for you.
Related
I just created a generated column 'gc1' of stored type in my table tbl1.
When I am running this command:
DESCRIBE tbl1;
It shows me the 'STORED GENERATED' for gc1 in the Extra field.
When I am checking triggers using SHOW TRIGGERS; command,
it is not showing me anything related to the generated column.
I am not able to get the expression used to generate the column gc1.
I tried the MySQL documentation as well but got nothing.
Any help would be highly appreciated.
I am currently in the process of moving all my Access databases to a MySQL server. I have some pretty big queries I would like to convert into sql direct.
The only thing is that in those queries I am using the content of a textbox in my form :
IIf(IsNull([Formulaires]![DialogueMAJDossier]![FiltreTypeEntree]),[TypeDossier],[Formulaires]![DialogueMAJDossier]![FiltreTypeEntree])
(Excuse me for all the names being in french)
I know that when I convert it to MySQL syntax, it should give something like this :
IFNULL(`Formulaires`.`DialogueMAJDossier`.`FiltreTypeEntree`, `TypeDossier`)
But I have no idea how to account for the text box value in my query.
Any help will be gladly appreciated
Pass-Through queries cannot have parameters, so you'll have to use a workaround.
Option 1:
Save the SQL with "variables" in a template table, e.g. SELECT foo, {FiltreTypeEntree} FROM bar.
Then before executing the Pass-Through query, read the template SQL, Replace() the variable with the result of your IIf expression, and set the .SQL property of the query with the final string.
Option 2:
Create a "Variables" table in MySql. Fill its fields via code, and have your Pass-Through query join this table to get the variable values.
In a multi-user scenario, you'd have to introduce some kind of session management for Option 2, so I'd go with (1) in this case.
So I don't want this thread to be marked as spam, as a previous thread was on this topic was, so I will explain what I have done so far and my issue is and ask if there are any solutions.
I have a MySQL database on my laptop that I need to migrate to DB2 on iSeries. I'm using a tool, I won't say which one because of the spam issue, which allows me to "copy" a table in my MySQL database and "paste" it into my DB2 database.
The issue that I'm having is because the table names and column names contain spaces in the MySQL db, the tool is failing on the paste. I confirmed this by altering one table by replacing the spaces with underscores and the copy worked perfectly. I have over a hundred tables I need to copy over and don't want to have to manually edit every table and column name.
Is there a way to globally replace spaces with underscores in MySQL table names and columns?
Any other ideas? I'm also researching a way to force the query the tool creates to enclose the object names in quotes, but have had no luck so far.
Thanks for any help and suggestions you can provide.
Since Stack Overflow is about helping to solve programming problems, I'm going to ignore the issue of deficiencies in the chosen tool and propose a programming solution to the larger problem - DB2 does not allow spaces in table and column names. You did ask for any suggestions...
Write code that reads the MySQL catalog tables. In DB2 they'd be SYSTABLES, SYSVIEWS, SYSINDEXES, SYSCOLUMNS, etc. Read SYSTABLES and use that as the 'primary' source for the rest of the code. Check the table name; if it has an embedded space, replace it with an underscore. Use SYSCOLUMNS to generate a CREATE TABLE statement that will create the new table (in a new MySQL database?) - also performing space to underscore replacement. After issuing the CREATE TABLE, generate an SQL statement that will INSERT INTO the new table the columns from the old table; again doing the space to underscore substitutions. Once the new table is populated, generate SQL statements to CREATE VIEW, CREATE PROCEDURE, CREATE FUNCTION, etc.
The general idea is that you will completely re-create your MySQL database with table, view and column names that are immediately compatible with DB2 for i so that your tool can do it's thing.
Of course, if you go to that much trouble it'll probably be just as easy to directly CREATE TABLE, etc on the IBM i side rather than go through an intermediate tool that isn't quite what you need.
I have downloaded a mysql table in text format from one our collaborator's. I have dumped the table into a table on mysql database on my machine successfully. The table was created using their sql file. SO they have some of the fields with blob data-type, and I am unable to view them in mysql. when I opened the same downloaded text file with csv I could see the fields with blob data-type with letters like BC,ABD,BDS. I do not understand why I am unable to view the fields in mysql. Anyone have ideas?
This is sure you can not see the blob data directly when you view the table data from mysql. But i think when you click the edit link of particular row you might see the data but i'm not sure about this. If you are using any server script then you definitely gonna see data without any hassle using simple select query. Like
SELECT COLUMN_NAME FROM TABLE_NAME
// REGARDLESS OF COLUMN_NAME DATA TYPE
I wonder if there is a (native) possibility to create a MySQL table from an .xls or .xlsx spreadsheet. Note that I do not want to import a file into an existing table with LOAD DATA INFILE or INSERT INTO, but to create the table from scratch. i.e using the header as columns (with some default field type e.g. INT) and then insert the data in one step.
So far I used a python script to build a create statement and imported the file afterwards, but somehow I feel clumsy with that approach.
There is no native MySQL tool that does this, but the MySQL PROCEDURE ANALYSE might help you suggest the correct column types.
With a VB Script you could do that. At my client we have a script which takes the worksheet name, the heading names and the field formats and generates a SQL script containing a CREATE TABLE and a the INSERT INTO statements. We use Oracle but mySQL is the same principle.
Of course you could do it even more sophisticated by accessing mySQL from Excel by ODBC and post the CREATE TABLE and INSERT INTO statements that way.
I cannot provide you with the script as it is the belonging of my client but I can answer your questions on how to write such a script if you want to write one.