Hi friends,
In the book Inside Microsoft SQL Serverâ„¢ 2005 T-SQL Querying, the author Itzik Ben-Gan tell us the order or SQL Server 2005's logical query processing is:
(8) SELECT (9) DISTINCT (11) <TOP_specification> <select_list>
(1) FROM <left_table>
(3) <join_type> JOIN <right_table>
(2) ON <join_condition>
(4) WHERE <...
I got this trigger, I want to evaluate the mobile phone and insert into another table if the regexp returns a value. I've tried with this but not success.
delimiter //
create trigger companyA_phones after insert on customer
for each row
begin
set @phone = (select new.phone from customer where new.phone regexp '^0416');
if (@p...
I have a field with type= date in MySQL DB.
It store dates in YY-m-d format.
How can I write a query which will get the rows where day is equal to some value, for example 1?
I need to get only first days of months (2009-11-01, 2009-12-01, 2010-01-01...)
Thanks
...
I am using SQL Server 2008 express, any reason??
however, if i convert to decimal(6,4) is work. e.g. Select CONVERT(decimal(6,4),'1.1234');
thanks you.
...
I am using SQL Server 2008 express, below is the SP, who return
(0 row(s) affected)
Msg 515, Level
16, State 2, Procedure
sp_AddCarrierFees,
Line 21 Cannot
insert the value NULL into column
'attribute_value_id', table
'MyDevSystem.dbo.shipping_fees';
column
does not allow nulls. INSERT fails.
The sta...
Hey,
having some problems figuring this one out.
select *,(select top 1 chicken_nr from chicken_photo where chicken = code order by [sort]) as Photo from Chicken
Code is a column in Table Chicken
Basically getting the cover photo for this chicken.
To make it clearer, I want it to return multiple rows from table Chicken. But only a s...
I have 2 databases. In first one I have 10 tables. Second one is only 1 table. I would like to select 1 columns from each table from 1st database and Insert INTO another database. How can I manage this using INSERT INTO statement in VB.net?
...
Really hoping someone can provide some code sample or point me in the right direction (with examples C#.net). I did try to check if this question was asked before.. but didn't really find code samples which answered all my questions.
Image folder for saved files -should this be in the solution or somewhere else
What kind of data type -...
The answers to my previous post encouraged me mixing SQL and NoSQL db.
What is the best practice implementation of two databases in terms of application context configuration and DAO creation?
Let's choose Derby as the SQL db and Cassandra as the other one. What I am searching for is e.g. an example appcontext.xml, two DAOs, one imple...
Using EXPLAIN for the query below shows
SELECT cha.cid AS cid,
cha.data AS dl
FROM cha, c_users
WHERE uid = 808
AND cha.cid = c_users.cid;
it does a full scan on cha table
uses the multi column index(cid,uid) from c_users.
Why doesn't it not use the primary key index from cha and rather does a full table scan. Is there a b...
I have a table with three fields id,minvalue and maxvalue.These fields carries multiple values like...
id Minvalue maxvalue
1 100 200
2 201 300
3 301 400
...and so on. If I supply 250 as input, how can I retrieve its corresponding id using mysql query?
Thanks
...
I have two tables, products and product_tags.
products table;
product_id int
name varchar
description text
price decimal(12,2)
status enum
sale int
hit int
date_add datatime
date_update datetime
product_tags table;
tag_id int
product_id int
tag varchar
where the product_tags table has a one to many relation with products, for exa...
Dear all,
I wanted a guidance for one problem . Suppose i have one table alphabets (alpha, id).
In column alpha having value a-z and in column id all values are 1.
a 1
b 1
. .
. .
z 1
Now i want a database query to insert data like a-z but with id=2 .
Can anybody help me out .
...
What's the best in performance to determined if an item exist or not specially if the table contain more than 700,000 row
if (Select count(id) from Registeration where email='[email protected]') > 0
print 'Exist'
else
print 'Not Exist'
OR
if Exists(Select id from Registeration where email='[email protected]')
print 'Exist'
else
...
I am using Derby.
I have a table with two columns X and Y.
I want to select column X but group by column Y.
This means I want to show only ONE X value for each row with the first Y value to it.
How can I do this?
CREATE TABLE test (
x INTEGER NOT NULL ,
y INTEGER NOT NULL )
INSERT INTO test VALUES (1,1) ,(1,2) ,(1,3) ,(2 ...
Hello,
I was looking on different questions on this issue, but couldn't find an answer for my problem.
This is my query:
SELECT SUM( lead_value ) AS lead_value_sum, count( DISTINCT phone ) AS SUM, referer
FROM leads t1
INNER JOIN leads_people_details t2 ON t1.lead_id = t2.lead_id
INNER JOIN user_to_leads t3 ON t1.lead_id = t3.lead_id
...
Hi all,
This should be a fairly straightforward question, but I haven't been able to find a solid answer online. I'm trying to insert multiple rows into the same table, but with only one statement. The most popular I've seen online is the following, but I've read that it only works with SQL Server 2008:
INSERT INTO Table (Name, Locatio...
This should be a straightforward question, but I haven't found a clear answer yet. Does anyone know how to delete multiple rows from a single table in SQL Server 2005, using a single query? I wondered if it might just be the opposite of inserting multiple rows, using the UNION ALL method. So would this work? :
DELETE FROM Table (Name, L...
I have many tables in my database and I am collecting calculated values with following code and would like to Insert those values into other table. I am Using SELECT INTO method but database tells me that "Incorrect syntax near the keyword INTO line ...". I believe that there is something I am missing but not sure where. Code looks fine....