sql

error wrong number of arguments

this query is giving me error. I am looking for two similar letters in the 2 tables SELECT clients.ClinicName, clinics.clinicName, clinics.ClientID, clients.[Clinic ID] FROM clients, clinics WHERE Left(clients.ClinicName, Instr(Instr(clients.ClinicName," ") +1,clients.ClinicName," ")-1) = Left(Instr(clinics.clinicName," "...

subquery using IN clause

---------- User ---------- user_ID(pk) UserEmail ---------- Employer1 ---------- Emp1ID(pk) Emp1NO ---------- Employer2 ---------- Emp2ID(pk) Emp2NO ---------- Project ---------- ProjEmpID ProjEmpMGRID I need to display User Email ID. The relation between the table goes like this: In the Employer(1&2) table EmpID contains the value ...

Replace all fields in MySQL

Hi, I need to replace some chars in the columns of a table, by using the REPLACE command. I know that the REPLACE command needs a column name, then the text to change (in the following example, the 'a' char) and the new text (in the following case, the 'e' char). UPDATE my_table SET my_column = REPLACE (my_column,'a','e' ); So that ...

select from access database file and insert to sql Database

Hi All, I have an access database file (test.mdb) and I need to write a stored procedure which will select some records from tblTest in test.mdb and insert them into tbsqlTest in my sql database . ==> I need a SP like this : BEGIN select * into tblTest from [test.mdb].[tblTest] where (my condition) END ...

table with 25 columns of varchar(1000) problems

Hi All, I have a table with 24 columns of varchar(1000) and 1 column with varchar(8000), my source is of same data lengths of text files. Would I get any problems in the processing due to data lenghs in performance or over size of the sql limit page size. thanks prav ...

SQL: Is there a way to validate the value from a column against the value from a column in a different table NOT using Foreign Key?

I want a column from a table to have a limited domain, which is listed in a different table. Usually, I'd just do this: ALTER TABLE Table1 ADD CONSTRAINT FK_Especialidade FOREIGN KEY (column1) REFERENCES Table2 However the values that "column1" must reference should not be a Primary Key in Table2. Any suggestions? ...

Is there any reason why you cannot select a statement as a bit in SQL Server?

Hi, I am wondering why the following fails: SELECT price<500 as PriceIsCheap and forces you to do the following: SELECT CASE WHEN (price<500) THEN 1 ELSE 0 END as PriceIsCheap When, as per the answer to this related question, the conversion table says that an implicit conversion should occur. ...

help optimizing query (shows strength of two-way relationships between contacts)

i have a contact_relationship table that stores the reported strength of a relationship between one contact and another at a given point in time. mysql> desc contact_relationship; +------------------+-----------+------+-----+-------------------+-----------------------------+ | Field | Type | Null | Key | Default ...

Uploading large files in SQL azure

Hello All: Can anybody help me in understanding how to upload large files in SQL azure using block. I am not able to find any good implementation of Blocks to upload files in SQL azure. Thanks, Ashwani ...

Hiberante property type list, add it through sql to table

Hi all, I recently added new property in one class, its list property and I have written xml mapping for that property,due to few reasons I am not suppose to delete database or use create option in hibernate config file to update changes. I have to do it manual by executing sql queries on database. xml mapping file: <list name="items"...

getting one to one result from one to many relationship

Hi there , my situation is that i have one to many relation ,like order and orderdetails ,i need to get order which has single order details. ...

If entity x is existence-dependent on entity y then what is x said to be?

If entity x is existence-dependent on entity y then what is x said to be? a. Dominant entity b. Subordinate entity c. Primary entity d. Secondary entity What can be the right ans select? ...

Lock out of mysql db thru webmin!

[root@cp ~]# mysql> CREATE DATABASE foo; [root@cp ~]# mysql> GRANT ALL ON foo.* TO root@'my home ip' IDENTIFIED BY 'aron1252'; [root@cp ~]# mysql> update user set Host='my home ip' where user='webadmin'; [root@cp ~]# GRANT ALL ON foo.* TO root@'localhost' IDENTIFIED BY 'newpass'; -bash: GRANT: command not found [root@cp ~]# mysql> GRANT...

Enforce SQL Server to drop a database

When I'm using Management Studio Express to drop a database there is an checkbox "Close existing connections." which close open database and enforce it to drop. How can i drop a database programmatic by closing open connections and check it's ever exists before? ...

Insert Datetimepicker text in SQL Database

how to Insert Datetimepicker text in SQL Database as datetime datatype ...

ActiveRecord Find - Skipping Records or Getting Every Nth Record

I'd like to do a query where I select a bunch of data, but I'd like to be able to then decrease the resolution of that data by only selecting, say, every third record, or maybe even every hundredth record, or whatever. Is there any straightforward way to do this with ActiveRecord? ...

MySQL UPDATE query with subquery taking forever

Hi, I have a MySQL UPDATE query which takes a long time to complete. Am I missing a much simpler way to achieve the same result? "UPDATE table2, table1 SET table2.id_occurrences = (SELECT SUM(IF(id = table2.id, 1, 0)) FROM table1) WHERE table2.id = table1.id;" table2 contains all possible values of id, exactly one record for each. t...

Many roundtrips to the database, or all data / filter?

Which method would be fastest / most efficient? A) Read all data (822 rows) including those I do not need then filter / output those I do B) 3 Round trips to the db using params filled via the last query to select only the data I need Thanks. ...

oracle insert if row not exists

insert ignore into table1 select 'value1',value2 from table2 where table2.type = 'ok' When I run this I get the error "missing INTO keyword" . Any ideas ? ...

using nested query to insert values into a table

how to insert values selected from another table using nested query ...