Hi!
How can I join these 2 queries to get all table info in one result?
A - Get all columns and their datatype belonging to table Customers
select COLUMN_NAME, DATA_TYPE from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'Customers'
B - Get all constraints on the table Customers
SELECT KCU1.CONSTRAINT_NAME AS 'ConstraintName'...
I am trying to query a mysql table which contains strings of numbers
(i.e. '1,2,3,4,5').
How do I search to see if it has '1' but not '11' bearing in mind if it is '9,10' '9%' doesnt work??
Fixed!
(field like '10' OR field like '%,10,%' OR field like '%,10' OR field like '10,%')
...
I'm using Sqlserver express and I can't do before updated trigger. There's a other way to do that?
...
I'm working on a project where we are thinking of using SQLCacheDependency with SQL Server 2005/2008 and we are wondering how this will affect the performance of the system.
So we are wondering about the following questions
Can the number of SQLCacheDependency objects (query notifications) have negative effect on SQL Server performance...
I want to extract some queries to a CSV output format. Unfortunately, I can't use any fancy SQL client or any language to do it. I must use SQLPLUS.
How do I do it?
...
Does the order of conditions in there where clause affect the speed of the query?
For instance, could:
select fname, lname
from people
where isValid = 1 and lname like '%test%'
be faster than
select fname, lname
from people
where lname like '%test%' and isValid = 1
Duplicate: Does the order of columns in a WHERE clause matter...
I am using spring-2.5.6 to connect from a standalone application to an Oracle 10g database (ojdbc14.jar) using the org.apache.commons.dbcp.BasicDataSource. When I try to retrieve a SqlRowSet using the public SqlRowSet queryForRowSet(String sql, Object[] args) throws DataAccessException method I am getting an 'java.sql.SQLException: Inval...
In my application we have to call SET DATEFORMAT YMD before each and every operation. In the master.dbo.syslanguages in entry for my language (polish, lcid=1045) there is dmy format.
So is there any way I could change this entry or create a new language that will be like old one, but with changed DATEFORMAT?
...
Our pool size is set to 600 connections for our web app to our database. However I just got an email from the client saying they are pushing our training course to 4000+ users telling them that they should get it completed by the 27th of this month. Should I up it to 4000?
...
Is there a way to do the following in Oracle:
SELECT *
FROM Tbl1
JOIN Tbl2
USING (col1)
AND ON Tbl1.col2 = Tbl2.col3
...
I got a single table and it contain 4 fields
Id|Hospital| Doctor|patient
1 A D1 P11
2 B D6 P61
3 A D2 P21
4 A D1 P12
5 B D7 P71
6 B D6 P62
7 B D6 P63
Doctors are unique to the Hospital. They don't work in other hosp...
Is there any benefit to explicitly using the StoredProcedure CommandType as opposed to just using a Text Command? In other words, is
cmd = new SqlCommand("EXEC StoredProc(@p1, @p2)");
cmd.CommandType = CommandType.Text;
cmd.Parameters.Add("@p1", 1);
cmd.Parameters.Add("@p2", 2);
any worse than
cmd = new SqlCommand("StoredProc");
cmd...
There must be a better way of writing this query.
I want to select all the data between a pair of dates. Ideally the first and last rows of the result set would be those specifed in the WHERE clause. If those rows don't exist, I want the rows preceeding and following the requested range.
An example:
If my data is:
...
135321, 20090...
Hello,
I know this may be something stupid but I decided to ask any way.
I've been trying to query something like:
cursor.execute("select col1, col2 \
from my_tablem \
where afield like '%%s%'
and secondfield = %s
order by 1 desc " % (var1, var2) )
Bu...
Is there a simple way in, say Microsoft SQL Server Management Studio to run a saved .sql script on a list of databases?
...
I'd like to loop over a list of tables. For each table, I'd like to run an update query.
Psuedo code:
ArrayOfTablesObjects = {['tablename1','fieldname1'],['tablename2','fieldname2']......}
foreach @tablename in ArrayOfTablesObjects
UPDATE @tablename
SET @fieldname = 'xyz'
WHERE @fieldname = '123'
end foreach
...
FROM [TABELA DE PRODUTOS/ESTOQUE] AS T1
, [TABELA DE PRODUTOS] AS T2
, [TABELA DE MOVIMENTAÇÃO DE ESTOQUE] AS T3
, [TABELA DE FORNECEDORES] AS T4
, [TABELA DE PRODUTOS/ESTOQUE] AS T5
WHERE (((T1.Produto)=[T2].[ID])
ETC
So, how can I add a JOIN between those tables ? I need a left join, like:
FROM [TABELA DE PRODUTOS/ESTOQUE] <- TABLE...
I'm currently using Eclipselink, but I know now days most JPA implementations have been pretty standardized. Is there a native way to map a JPA entity to a view? I am not looking to insert/update, but the question is really how to handle the @Id annotation. Every entity in the JPA world must have an ID field, but many of the views I have...
I am maintaining an old VB6 application, and would like to include SQL scripts directly in part of the project. The VB6 application should then extract the text of this script and execute it on the server.
The reasons for this approach are various - among others, we want to deliver only an updated executable rather than a complete updat...
I am not a database person, exactly, and most of my db work has been with MySQL, so forgive me if something in this question is incredibly naive.
I need to delete 5.5 million rows from an Oracle table that has about 100 million rows. I have all the IDs of the rows I need to delete in a temporary table. If it were a just a few thousand r...