I have a number of .sql files which I have to run in order to apply changes made by other developers on an SQL Server 2005 database. The files are named according to the following pattern: Is there a way to run all of them in one go? Answer Create a .BAT file with the following command: If you need
MySQL: Order by field size/length
Here is a table structure (e.g. test): Field Name Data Type id BIGINT (20) title varchar(25) Description Text A query like: But I would like to order by the field size/length of the field description. The field type will be TEXT or BLOB. Answer The LENGTH function gives the length of string in bytes. If you want to count (multi-byte)
How to log SQL statements in Grails
I want to log in the console or in a file, all the queries that Grails does, to check performance. I had configured this without success. Any idea would help.
What does the specified number mean in a VARCHAR() clause?
Just to clarify, by specifying something like VARCHAR(45) means it can take up to max 45 characters? I remember I heard from someone a few years ago that the number in the parenthesis doesn’t refer to …
How to search multiple columns in MySQL?
I’m trying to make a search feature that will search multiple columns to find a keyword based match. This query: works only for searching one column, I noticed separating column names with commas results in an error. So is it possible to search multiple columns in mysql? Answer You can use the AND or OR operators, depending on what you
Python: Number of rows affected by cursor.execute(“SELECT …)
How can I access the number of rows affected by: Answer Try using fetchone: result will hold a tuple with one element, the value of COUNT(*). So to find the number of rows: Or, if you’d rather do it in one fell swoop: PS. It’s also good practice to use parametrized arguments whenever possible, because it can automatically quote arguments
How to troubleshoot ORA-02049 and lock problems in general with Oracle
I am getting ORA-02049 occasionally for some long-running and/or intensive transactions. There is seemingly no pattern to this, but it happens on a simple INSERT. I have no clue how to get any sort …
how does a SQL query work?
How does a SQL query work? How does it get compiled? Is the from clause compiled first to see if the table exists? How does it actually retrieve data from the database? How and in what format are the tables stored in a database? I am using phpmyadmin, is there any way I can peek into the files where data
Is there a command to test an SQL query without executing it? ( MySQL or ANSI SQL )
Is there anything like this: TEST DELETE FROM user WHERE somekey = 45; That can return any errors, for example that somekey doesn’t exist, or some constraint violation or anything, and reporting …
How does contains() in PL-SQL work?
Have a lot of unnecessary results using contains() method in my query. Don’t tell me to use like or something else. It is hardcoded and couldn’t be changed. Answer Contains is used on text fields that have a ‘CONTEXT Index’, which indexes a text field for searching. The standard usage is like this (using the score operator to display what