Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




SQL Source For A View


How do you obtain the SQL source that created a View?

I can Describe the view, but that doesn't give me the SQL that created it.

. . .

I should have searched the forums a little longer. The answer lies in the

SHOW CREATE VIEW viewName statement.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Source For SQL
Is there a freely available source for a table populated with auto makes
and models by year? (Circa 1970 to present) Such a table would be useful
for databases used by car dealers, auto parts stores, repair shops, etc.

Source Control
Does anyone know if there is a program (for windows) that can help us catalog our sprocs and table setups into source control?

Source Command?
I have a users.sql file that I want to import into mysql. When I tried this
source F:gusers.sql

It gives me an error like this:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use n
ear 'source F:' at line 1

ERROR 1102 (42000): Incorrect database name 'sers.sql'

but if I copy this file into F:data and use the command source F:datausers.sql
it worked fine.

Using Source Command
I'm using mysql 5.0 on a WinXP system.

I thought I could use the source command from the mysql> prompt to read text files containing sql statements to do things like create tables, but no matter what way I type my file name the source command says it can't open the file.

ERROR:
Failed to open file'"foo.txt"', error: 22

I've tried quotes, no-quotes, full path, 's, /'s.

Source Duplicate
I created a database from a CSV file. Later, I recieve an updated CSV file. The second file contains most of the data from the first file, however some records have been removed and some have been added. Resourcing the database from the new CSV file is not an option because the unique key id column is shared with other tables. So my dilema is, how can I source in the new CSV file and exclude any rows that already exist? Also, how can I identify rows that no longer exist?

I have made a php script that fscanfs my CSV file then runs a seperate query for each row to see if each seperate record is there or not and generates a new sql script for removing and adding records. But, that means 1 query on the database per record, I have around 200,000 records. So this method is not worthwhile, I gave up after an hour of waiting on it.

I also tried using diff, but every time a new record is present it throws off the list and then im removing and adding records back and forth.

Execute Source
Is there anybody that knows as to run a query from DOS (I tried with --execute source filename.sql and the error meassege is ERROR1102: incorrect database name filename. When I enter mysql and use directly source filename.sql the query runs).

SOURCE Command
i am new to mysql.i have a file full of sql statements
like
insert into mysql1.table1 values(4343);
.
.
.
now i want to run these statements and create my mysql table with data in it.
i was told to use a SOURCE command but iam having problems
from the mysql prompt i tried
mysql> source test.sql ( this is the file that has all the sql statements)
and i got "file could not be located" error: 2
my questions:
how can i syntactically specify the location of my file ?
will the SOURCE command serve my purporse?

Open Source Question
We are in the process of designing and building an application to collect a relatively small amount of discrete data (less than 100 data elements) from a potentially large group of industrial facilities. This system needs to be Open Source so other organizations can use the application by simply "plugging" in the app to do authentication/authorization (Open LDAP?) with a home-grown security design, access a web app (J2EE & probably Linux O/S), and MySQL as the backend. Certainly it's more complicated than what I describe, but I have my doubts of the capabilities of MySQL to be "robust" (yuk, I hate that word) enough to handle the potentially large number of simultaneous connections, among other issue including remote connection to Oracle DBs. I'm new to the organization and my boss's boss is the driving force behind the development. He's gung ho to get it built, but (beyond the political nightmare) I would like to "caution" him that the chosen platform is suspiscious at best.

How To Connect To An ODBC Source
I need help connecting mysql to an Oracle database. The Oracle database is set as an ODBC driver on my PC. I currently use MS access, connect via the ODBC connection and it runs great.

I now want to connect to this ODBC connection using mysql, but I don't know how. Can anyone get me connected?

Creating Data Source For My-SQL DB!
How can i create a data source for a My-SQL Database?

Stored Procedures And Source
I'm trying to script a stored procedure using a .sql file. Having no problems writing the same thing from the command line but I need to have all sp's under source control.

This is the syntax in the file I'm using:

USE db_1;

DROP PROCEDURE IF EXISTS test;

CREATE PROCEDURE test()
BEGIN
SELECT * FROM note;
END

Compile MySql Source

What do I need to compile MySql source?
I want to create MySql with SSL, and AFAIK i need to compile it.
Do I need MS Visual C++ or something like that ( I work in Delphi )?

Wrapping Database Source
Is there a wrap putility available for MySQL to wrap or obfuscate database source code? The reason for this being if I place a database off-site people who have access to the DB cannot steal your source.

Compiled Mysql From Source
I'm trying to install the DBD::mysql perl module, which, apparently, needs the mysql-devel stuff. If I compiled mysql from source, can I install the devel RPM without it messing up my settings? I have mysql in a non-standard directory.

Errors With Source File
The file mysqlqui-win32-static-1.7.5-2.zip with file size of 37k
downloaded from http://www.mysql.com/downloads/gui-mysqlgui.html is
corrupt. Is there a mirror with a compiled windows xp compatible version
somewhere?

Can't Decide On MySQL Source Compile Or RPM
In about a week I need to install my new website which I have been working on for about 3 months. The website will run on a multiple of servers, but one of the primary servers will run as a MySQL database only server. In the past I have installed the MySQL server from yum (an update manager).

I have been looking at ways to improve performance on my database server and one option was to install the server from source. By using the correct compile flags and only compiling the extensions into MySQL that you need the result can be rewarding. But is it really?

The problems that I see with a source install is that updating it will take longer (since the database has to be compiled each time). This may get to be annoying each time a bug is found. Also I am kinda paranoid of some compile related errors.

What should I do? Just stick to installing from an update manager? Or should I install from source and take full control of my server.

Making A .bat File For The SOURCE Command
i have a sql script file that i normally
run from the mysql prompt using the command SOURCE

so i first i do
mysql> use tms;
then i do
mysql> source /path/to/file/script.sql;

how can i create a batch file for this process

my database username is root
and no password

Databases Removed With Source Re-compile?
If I have rpm's of mysql already installed on Linux Mandrake 9.1, and I need to remove these, install the source and re-complile, will I lose the database amd data already created? Also, webmin , will it be affected at all by this action?

Connect To Database From A Remote Source
I own a website and plan on running multiple message boards on it...the problem is that I would like a database per board...however my host only gives 1 database....unless I want to pay an extaordinary amount of money for more.

So I have used my PC as a webserver before without any problems and in fact ran a pretty big board off it with php, mysql, phpmyadmin installed.

So my thought was to use a couple of databases off my PC to help run the new boards.

I have created the database...but I'm having trouble with the board connecting.

I'm sure that it's some kind of permission that needs to be inserted for the remote host to connect to my databases.

Running MySQL's 'source' Command
I am having failures processing the following command and I wonder
if you can tell me what I must do in order to have success. When I try
to run source mysql_dump.sql.txt ==> it is a problem for me.

1) I put the file in /home/mlh/public_html/credifree/sql_script/.
2) I made that directory my current directory
3) I typed mysql and pressed ENTER
4) I then typed source mysql_dump.sql.txt and pressed ENTER

A bunch of error messages saying
ERROR 1046: No Database Selected
filled up the screen.

Well, of course there was no database selected. I do not yet have a
database. I thought the whole point of running
source mysql_dump.sql.txt
was to CREATE a set of database files on my linux box. Is that
incorrect? What must I do to avoid this error 1046?

And now, the last question...
Can you tell me where the database files will be placed when running
source mysql_dump.sql.txt as I described above from the same current
directory as described above? I do wish to KNOW in advance where the
files will be created.

Good Source Of Information Re Design
I was involved in software development back in the 1980's and I now want to design a system for use based on a database (probably MySQL). Can anyone suggest a good site to vist where the rudiments of querying the database are explained in an accessible manner?

Basically, I want to understand what can be done and what cannot if I put a front end on to access the database.

MySQL Binary Or Source Distribution
I'm interested in which one is better for performance issues? The
binary distribution or a self compiled one?

Downloading The Open Source Version
Can't download the opensource version.
Anybody have this problem?

Pipe An Sql Source File In MySQL
Question: How can the command "source:data.sql" work. It says file cannot be found?

This is after I saved the files in E:Mysqldata

Background
--------------
I have just set up MySQL,PHP and Apache.

Since I can now manipulate data, both from command and using HTML.

MySQL Open Source And Enterprise
what is the main difference of the two... enterprise and open source

Echo SQL Commands From A Source File
Running mySQL under Windows XP. Trying to debug a long input file of SQL statements (building tables and loading data from tab delimited text files) I want to be able to see the SQL commands that are executing in the output printed to the SQL command window so I know which error messages apply to which command. I have show warnings statements after each SQL statement at the moment so I see the errors/warnings, just not the command that generated the errors/warnings.

Is there an ECHO command or a flag when calling the script to get commands echoed as they are executed?

MySQL Binary Or Source Distribution
I'm interested in which one is better for performance issues? The
binary distribution or a self compiled one?

INSRT With Old/new Data From Multiple Source Tables
Here follows a simple descripton of the issue I am facing:

Table 1:
id INT auto_increment (PRIMARY KEY)
userid INT NOT NULL (will hold an ID from table 2)
..other fields..

Table 2:
id INT auto_inc (PRIMARY KEY)
username VARCHAR (UNIQUE index)
..other fields..

I'd like to use one or more SQL statements (MySQL 5.x) which make the following magic happen:
1. Look up an ID from table 2, based on the username I provide
2. If the username cannot be found, INSERT the new username
3. INSERT a new record into table 1, taking either the existing ID or the newly inserted ID fromtable 2, depending on what happened in step 2.

I'd rather execute all this on the MySQL server that in PHP scripts, becuase I think it is faster.

I've tried the following TRIGGER, but I am new to triggers, so I might have made mistakes (assume the tables in the below SQL already exist):

DELIMITER |

CREATE TRIGGER addfields BEFORE INSERT ON table1
FOR EACH ROW BEGIN
IF NEW.userid IS NULL THEN
INSERT INTO table2 SET username='Paul Kemper';
SET NEW.userid = LAST_INSERT_ID();
END IF;
END;
|

DELIMITER ;

INSERT INTO table1 SET userid=(SELECT id FROM table2 WHERE username='Paul Kemper';

DROP TRIGGER addfields;

I get an error message saying the userid cannot be NULL.

Open-source/free DB Modeling Tool
I'm looking for a decent DB modeling/designing tool that is free and supports the following features:

1. Visual design of tables/relationships
2. Syncronization to database
3. Query mode
4. Ability to sync with different database types

I've been using DBDesigner, but it has a few bugs that are really annoying.

Use A Source Sourcefile.sql Command Via The ODBC Connector?
I have a source file which creates and populates the database, I wolud like to be able to call this file from withing my application program using the ODBC connector. However when I try I just get error 1064.

My application is in java .. here is the code snippet concerned..
try {
            Statement st = con.createStatement();
            sqlquery = "source c:mysqlin
j_create.sql";
            rs = st.executeQuery(sqlquery);
            try {
                while (rs.next()){
                    System.out.println(rs.getString(1));
                }
                
            } catch (SQLException se) {
                System.err.println("reading SQLException: " + se.getMessage()) ;
                System.err.println(sqlquery);
            }
} catch (SQLException e){
            System.err.println("querying SQLExcpetion " + e.getMessage());
            System.err.println("err code " + e.getErrorCode());
            System.err.println(sqlquery);
}

Source For SQL Or CSV Auto Make/Model Data?
Is there a freely available source for a table populated with auto makes
and models by year? (Circa 1970 to present) Such a table would be useful
for databases used by car dealers, auto parts stores, repair shops, etc.

Source For SQL Or CSV Auto Make/Model Data?
Is there a freely available source for a table populated with auto makes
and models by year? (Circa 1970 to present) Such a table would be useful
for databases used by car dealers, auto parts stores, repair shops, etc.

Linking HTML To A Mysql Data Source
I have a question and perhaps one of the bright sparks here can guide our thoughts.

1. We have a mysql based application that we use in our daily business operations. Capture information and then it drags it through to the web (php pages)

we have started a linking programme with other sites, but its a banner at the mo that simply links back to the main site. I would like that banner to be dynamic - i.e. change as the content (info feed) on our site changes) problem is HTML does not speak to mysql (so I am told).

I have seen simmilar feeds using JSP (Java server pages) - obviously with the HTML only calling the JSP page. which has the dynamic content.

Any suggestions as to how to tacle this problem? We do have a great programmer on the team, but this is new to him.

Comparison Of Open Source Database Servers
We need to compare the open souce Databases- MySQL and PostgerSQL based on features as well as on performance.

If anyone has done such a comparison, please share your knowledge with us.

Lock Wait Timeout Exceeded How To Find The Source ?
I am running an application using Innodb. My application is based on transaction concepts. So sometimes I do get this error of "lock wait timeout exceeded" ? I know this is due to some deadlock. But how and where can I analyse to see what is the cause to my this locking problem and how can I overcome this ? Thanks.

MySQL Open Source Application Components/plug-ins/add-ons
Perhaps someone might be able to tell me if there is a place to find MySQL opensource community application components/add-ons/plug-ins/contributions (whatever one might call them) which developers can reuse and modify to deliver MySQL applications faster?

eg. something like a community download repository, or something to that effect. Would likely contain database definitions, queries, performance analysis tools, etc.

Many open source products have this, I'm sure MySQL must, just feel silly that I can't find it.

Problem To Create Database Source From Openoffice With Mysql
i can link openoffice with mysql, but fail to edit it, add entry. The
problem may be from the permissions.

MySQLerror: Data Source Name Not Found And No Default Driver Specified
using this connection string;

"DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;PORT=3306;DATABASE=dbtest; USER=root;PASSWORD=admin;OPTION=3;"

i still encounter this message:

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

my connection works on the server.. but it doesnt work in clients?

How Query Results[SELECT] Appear In Tabular Form,using An Image With Source FromFIELD
How query results[SELECT] appear in tabular form , using an image with source from the database table field "source" , and a link towards detailed page from the database table field "link" ? How to store image & link URLs IN THE DB TABLE?

MySQL Database - Adding New Data Source 'Access Denied For User'
I am trying to install MySQL on my machine at the moment. I have downloaded the file mysql-essential-5.0.21-win32 from the MySQL website and installed it. I then downloaded MySQL Control Center, which came zipped in a folder called mysqlcc-0.9.2-win32.

I have installed both applications and I have a MySQL database which I have acquired from elsewhere. I copy/pasted it into my C:Program FilesMySQLMySQL Server 5.0data directory, but when I try to add a new database in MySQL CC it doesnt allow me.

I have also installed the ODBC for MySQL (called mysql-connector-odbc-3.51.12-win32). However, when I try to add a new data source in the Control Panel I get this error:

[MySQL][ODBC 3.51 Driver]Access denied for user 'versiontwo'@'localhost' (using password: YES)

versiontwo is the name of the database. the database has a password.

Is This Possible With A View?
I'm trying to cut down on the size of my database so I've changed it so that rather than implicitly setting every value in one table, I've split the data into two tables: one table (iData) contains data for the start of evey week:
iData
-----------------------------
2000-01-01 Volume: 20000000
2000-01-06 Volume: 30000000
2000-01-11 Volume: 40000000
Another table (jData) contains the delta (difference) from the previous iData entry:
jData
-----------------------------
2000-01-02 Volume: 1
2000-01-03 Volume: -2
2000-01-04 Volume: 1
2000-01-05 Volume: 3
2000-01-07 Volume: 2
2000-01-08 Volume: -5
2000-01-09 Volume: 6
2000-01-10 Volume: 1
2000-01-12 Volume: 2
2000-01-13 Volume: -4
2000-01-14 Volume: 4
2000-01-15 Volume: 3

Obviously this will save a lot of space as the delta is much smaller than storing the exact value (standard compression technique).

So what I would like to do is create a view to automatically display all of the data as if it were all stored in one table:

All Data:
---------
2000-01-01 Volume: 20000000
2000-01-02 Volume: 20000001
2000-01-03 Volume: 19999999
2000-01-04 Volume: 20000000
2000-01-05 Volume: 20000003
2000-01-06 Volume: 30000000
2000-01-07 Volume: 30000002
2000-01-08 Volume: 29999997
2000-01-09 Volume: 30000003
2000-01-10 Volume: 30000004
2000-01-11 Volume: 40000000
2000-01-12 Volume: 40000002
2000-01-13 Volume: 39999998
2000-01-14 Volume: 40000002
2000-01-15 Volume: 40000005

I know I can do this programatically, but is it possible to do this with a view? Any pointers would be much appreciated.



View SQL Files
I am about to by the content of a site, but it is in sql files. I need to view this content and extract to make a new site from it in html format.

How do I view SQL files and extract it content? Is there any program that does it?

Can I View .frm, .MYD And .MYI Files?
At my current host, the server crashed and all data seemed to be lost. Lucky for us they had had a backup of all data which they put back on the server.

But now I get errors with some tables in phpMyAdmin where they show up as "in use" and when I view them I get the following error:

MySQL
#1033 - Incorrect information in file: *.frm
or

MySQL
#1016 - Can't open file: '*.InnoDB'. (errno: 1)

Because of the issues, they send me the *.frm, *.MYD and *.MYI files.
But am I able to view these files to see the structure or data?
And can I verify if structure or data is corrupt?

View Implementation
Anybody has implemented View for MySQL?
I think it can be done outside of Database
if query transformation approach is used.

CREATE VIEW Model
SELECT * FROM Model_CA, Brand
WHERE Model_CA.brand_rid = Brand.rid

Select brand_name from Model
where model.name = 'Test'

This can be transformed into

SELECT brand_name FROM Model_CA, Brand
WHERE Model_CA.brand_rid = Brand.rid and
Model_CA.name = 'Test'

VIEW Problem
I create the next view:

CREATE VIEW VideoDB.FindCustomer AS
SELECT id, last_name&' '&name&' '&initial AS cname, picture, birthday, birthday_already, account_type, rents, exp_date, deposit, exp_deposit, auto1, kinship1, auto2, kinship2,
auto3, kinship3, auto4, kinship4, auto5, kinship5, auto6, kinship6
FROM VideoDB.customers;

When I execute the next statement the result is 0:
select cname from videodb.findcustomer;

How can I concat the whole name.
last_name&' '&name&' '&initial AS cname

Create A View
I have a master table and five detail tables. Now I want to have an overwiew on all detail tables that are related to the master table. The problem is that there are to many repeated records.

My wish is that to have each record of detail table in a single row with master table information in the view table. I tried to reach this with joins (left or right). No chance.. Code:

Mysqldump View
I try to dump the view definition and records using the following command.

mysqldump -uroot -psecret! --databases test --tables proxy_view > mytest.txt

What all I get is the view definition without records. What is the correct method of dumping a view?

Create View
I currently have a script that I have developed on a MS SQL server. As part of it I use a VIEW to do most of my lookups. I want to transfer it to a MYSql DB, but when I try and CREATE VIEW I get the following message....


mysql> create table t (qty INT, price INT);
mysal> insert into t values (3, 50);
mysql> create view v as select qty from t;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near 'view testv a
s select qty from t' at line 1
mysql>

I am using MYSQL for Netware. I am using an example that I have found to demostrate it, but it just does not work.

Exponential View
how to store numbers in exponential view to MySQL. E.g. 4,56e-9 = 0,00000000456

I have 4,56e-9 as a variable in perl and want to store it to MySQL. Decimal as typ seems not to work. Does i realy have to convert it to 0,00000000456?


Copyright © 2005-08 www.BigResource.com, All rights reserved