I have two identical tables in two different databases with the same data but they have different primary keys, I need to update these so they have the same key, so what I did was making sure that none of the tables had any key in common and that there were no duplicates
UPDATE db1.dbo.Table
SET db1.dbo.Table.pcol = rightPcol.pcol
FROM ...
Ok i am tryna make this code excute for every phone number in my db. Before following advice here i was only able to send to one number at a time, i got advice to add a while statment to loop it. However my code don't wanna work no more. Here is before and after. I know i did something wrong.
BEFORE (Working-no db)
// Set SMS options
$...
Hello all,
I have a SQL query like this (pseudo code)
Select ID, TEXT, 1, 2, 3, 4, 5, 6, 7 from blabla
but what I need is a query with 3 columns
Select ID, TEXT, STRING(1, 2, 3, 4, 5, 6, 7) from blabla
can I do this with just SQL?
EDIT:
Extra question:
It doesn't work if 1-7 return NULL or nothing. How can i convert NULL to an e...
I am inserting rows into SQL Server 2005 from PowerShell. I need to add a WHERE NOT EXISTS clause to my code to stop inserting duplicates. I am testing the SQL code in SSMS and cannot get it to work.
Where is the mistake in the following code?
INSERT INTO dbo.PrptyValSrce
(PrptySrceName, PrptyNameSrce, PrptyValSrce, PrptyTS)
VAL...
I'm looking for a single SQL query to run on an oracle table that will retain n number of records in a table and delete the rest
I tried the following
delete from myTable where pk not in
(SELECT pk FROM myTable where rownum <5 order by created DESC)
But it appears that I cannot have order by in the nested select.
Any help appreci...
I'am encountering a problem with my Web Apps and cannot find any answers on the web.
I have a Java Web
App that works on parallel with
tomcat and apache using mod_jk.
Everything works fine, but after one
day of running in tomcat, one of my
main servlet doing ajax request stop working. All the
others work fine. By this i ...
I have a requirement in SQL Server 2008 in development database
Only DBA's ( who are database owners ) can create, alter tables .
Developer's should not create or alter tables .
Developers can create/alter Stored Procedure/User Defined functions
in dbo schema and can execute SP/UDF.
Developers should have SELECT,INSERT,DELETE,UPDATE on...
Hi folks,
I'm using SQL Server 2005 with Django, I'm wondering if anyone has ever attempted to create an admin panel for SQL using Django.
Would be quite useful to have!
...
Hello,
I'm trying to get data from two MySQL tables, but having problems.
Usually, I'd use join to get data from two those tables depending on data, but this time I cannot, I think.
Here's situation:
I'm having tables photos and photos_albums.
photos ID ALBUM FILENAME
photos_albums ID TITLE NAME
I need to get all albums and photo i...
I have to filter orders which do not have a specific product.
It is simple, but the problem is that every order could have many lines, containing different products.
Here is an example of my data:
ID | Product | Customer | Quantidy | Date
1 | Apple | Alex Sorensen | 3 | 17.4.2009
2 | Orange | Alex Sorensen | 1 ...
Is there a way to get multiple counts depending on multiple conditions from the same table?
eg. Count for when Days is less than 15, and count for days between 15 and 30.
...
Consider the following queries.
select * from contact where firstname like '%some%'
select * from
(select * from contact) as t1
where firstname like '%some%'
The execution plans for both queries are same and executes at same time. But, I was expecting the second query will have a different plan and execute more slowly as it has...
Hey Guys,
I'm looking for a SQLite query which will return values that are great or less than 0.014763 for the lng and 0.008830 for the lat. I'm using the following code...
$latupp = $_REQUEST['currlat'] + 0.008830;
$latlow = $_REQUEST['currlat'] - 0.008830;
$lngupp = $_REQUEST['currlng'] + 0.014763;
$lnglow = $_REQUEST['currlng']...
Hello,
I'm trying to fix some errors on a big database of stock exchange data. One column (quantity) has the traded volume on each tick, and other column stores the cumulative volume (i.e., the sum of the previous ticks of the day). This second column is wrong in some cases (not a lot, so we can safely assume that no to adjacent ticks a...
Hi,
I am going to be building a application which will be used by people all over Europe. I need to know which collation and character set would be best suited for user inputted data. Or should I make a separate table for each language. A article to something explaining this would be great.
Thanks :)
...
I am struggling to find a working query in SQLite, that will return my records in their upcoming birthday along with the number of days it will happen
CREATE TABLE contact_birthday ('contact_id' varchar,'data1' varchar,'display_name' varchar)
data1 holds the birthday in YYYY-MM-DD format
Something like:
"1986-06-28","Angel","0"
"197...
I am having trouble with a SQL query.
SELECT t.topicname, m. *, ms.avatar
FROM `messages` m
INNER JOIN topics t ON m.topicid = t.topicid
inner join users u on m.author=u.username
inner join misc ms on u.userid=ms.userid
ORDER BY postdate DESC LIMIT 5
what i want to do is get the topicname from the topics table, every...
Trying to do this:
SELECT CASE WHEN field = true THEN one * another ELSE one END as case_field
FROM table WHERE case_field >= 9000
and receive an error that case_field doesn't exist.
Is it possible to do this without duplicating CASE ?
...
This is a contrived example using SQL Server 2008.
I'm essentially storing a list of ids in an xml column in a table:
temp (bigint id, xml ids)
I want to join the table itself to the xml nodes.
So far I have:
select * from temp x
join (
select x.id
, ids.id.value('@value', 'bigint') zid
from temp t cross apply ids....
As I understand it:
A Clustered Index orders the data physically by the index, so if you use Surname as a clustered index, when you do a select * you will get the surnames in alphabetical order.
A Non-clustered index is not physically reordering your database, but is creating a kind of lookup table that's ordered by the columns you cho...