I have an SP in SQL Server which runs hundreds of times a minute, and needs to check incoming traffic against a database. At the moment it does the following
INSERT INTO table
SELECT @value1,@value2 WHERE NOT EXISTS
(SELECT * FROM table WHERE value1 = @value1 AND value2 = @value2);
However, I could also go with
IF NOT EXISTS(SELECT...
SELECT *
FROM employees e
WHERE NOT EXISTS
(
SELECT name
FROM eotm_dyn d
WHERE d.employeeID = e.id
)
And
SELECT * FROM employees a LEFT JOIN eotm_dyn b on (a.joinfield=b.joinfield) WHERE b.name IS NULL
Which is more efficient,some analysis?
...
Hello everyone!
I need to execute in python a SQL query that adds a new column, in sqlite3.
The problem is that sometimes it already exists. So previous to executing the query I need to check if the column already exists.
If it does, then I won't execute the query.
Is there a way in sqlite to do that? Or do I have to make it throug...
Let's assume I have a table magazine:
CREATE TABLE magazine
(
magazine_id integer NOT NULL DEFAULT nextval(('public.magazine_magazine_id_seq'::text)::regclass),
longname character varying(1000),
shortname character varying(200),
issn character varying(9),
CONSTRAINT pk_magazine PRIMARY KEY (magazine_id)
);
And another table ...
Greetings stack overflow community.
I've recently started building an OLAP cube in SSAS2008 and have gotten stuck. I would be grateful if someone could at least point me towards the right direction.
Situation: Two fact tables, same cube. FactCalls holds information about calls made by subscribers, FactTopups holds topup data. Both ta...
I have two tables as follows:
tblCountry (countryID, countryCode)
tblProjectCountry(ProjectID, countryID)
The tblCountry table is a list of all countries with their codes and the tblProjectCountry table associates certain countries with certain projects. I need an SQL statement that gives me a list of the countries with their country...
Currently my controller lets a user submit muliple "links" at a time. It collects them into an array, creates them for that user, but catches any errors for the User to go back and fix. How can I ignore the creation of any links that already exist for that user? I know that I can use validates_uniqueness_of with a scope for that user, ...
I need to get dummy values if they do no rows returned from table. The If exists works by itself, but gives error with a Union. Can someone please guide me with a solution or a workaround?
create table test1 (col1 varchar(10))
create table test2 (col1 varchar(10))
create table test3 (col1 varchar(10))
insert test1 values ('tes...
I need to read an xml instance from an exist db.
I am attempting to connect chiba to a restful web service via the following command:
<xf:model>
<xf:instance id="data-instance"
src="http://myhost:8081/exist/rest/test/" />
</xf:model>
However, I get the following error message when I load the xform:
Object...
I have a button on my page that changes depending on what radio button is clicked. The button has the same text on it with the same id, but different classes. How do I test if the two different buttons exist depending on the radio.
<a id="submit" class="on" href="javascript:submit();">Submit</a>
<a id="submit" class="off" href="javascri...
is there a way to write this same SQL atomic instruction using Entities and LinQ?
IF EXISTS (SELECT * FROM MyTable WHERE ID = @Id)
UPDATE MyTable SET name = @name
ELSE
INSERT INTO MyTable (@Id, @name)
or do you need to call a stored procedure from within the EF?
...
Hi, i have a quick question. I have a 2D array that stores an instance of a class. The elements of the array are assigned a particular class based on a text file that is read earlier in the program. Since i do not know without looking in the file what class is stored at a particular element i could refer to a field that doesn't exist at ...
Hello. I hope a topic is self describing. I'm new on your site, it helped me much times but this time i was surprised not to find an answer on internet. The question is quite simple. Say, i have an element created in code:
var elem = docuemnt.createElement('div');
...
I wish sometime to check have i placed it into the DOM bef...
I have an application with a rather long chain of upgrade scripts. The application works in SQL Server 2005 - I'm trying to upgrade it so it will also work in SQL Compact 3.5
Part of the script involves dropping old indexes if they exist.
I REALLY want to have one script that can handle both scenarios. I've been having a lot of success...
Hello,
What do you think , does the Stored Procedure always return 1 ?
I am concerned about the if exists(..)
BEGIN
DECLARE @IsUserExisting bit
SET NOCOUNT ON
IF Exists
(
Select null FROM G_User WHERE
SamAccountName = @SamAccountName
AND NetBIOSDomainName = @NetBIOSDomainName
)
BEGIN
SET @IsUserExi...
I am trying to set up a MySQL trigger that does the following:
When someone inserts data into databaseA.bills, it verifies if databaseB.bills already has that row, if it doesn't, then it does an additional insert into databaseB.bills.
Here is what I have:
CREATE TRIGGER ins_bills AFTER INSERT ON databaseA.bills
FOR EACH ROW
BEGIN
...
Is there a way to check if a twitter username exists?
Without being authenticated with OAuth or the twitter basic authentication?
...
I use this for checking an existing emailId in my table and inserting it...It works fine how to show message to user when he tries to register with an existing mailId....
if (!taxidb.Registrations.Where(u => u.EmailId == reg.EmailId).Any())
{
taxidb.Registrations.InsertOnSubmit(reg);
taxidb.SubmitChanges();
}
and my control...
An alternative title might be:
Check for existence of multiple rows?
Using a combination of SQL and C# I want a method to return true if all products in a list exist in a table. If it can be done all in SQL that would be preferable. I have written a method that returns whether a single productID exists using the following SQL:
SELECT...
I'm trying to detect whether an image exists on a remote server. However, I've tried several methods and can't get any of them to work.
Right now I'm trying to use this:
if (!CheckImageExists("http://img2.netcarshow.com/ABT-Audi_R8_2008_1024x768_wallpaper_01.jpg")) {
print_r("DOES NOT EXIST");
} else {
print_r("DOES EXIST");
}...