sql

SQL and entity framework

Hi, I have an application where I move data from one table to another on the same database (some simple calculations are done). I use the entity framework to select the data from the first table and add it to the other table.I try to transfer appx. 100k rows and the problem is that it seems like it kills the connection to my database. Af...

ejb sql [select * from where A & 1]

Hello, i will use a query like this in ejb ql: Select * from whe A&1; But i have the following error: line 1, column 171: unexpected char [&]. How can i use this operator to check the bits in a row? ...

SQL ORDER BY issue

Duplicate of this question, which itself cross-references 3 other minor variants of the same question. Hi all, I am sorry but i am putting my question as a new question in this post.I need all your help very much now and i appreciate your help very much SELECT * FROM (SELECT distinct gl.group_id, gl.group_name, ...

Inserting an array within an object construction, constructed based on a query

How can I construct an object using a query if I also need to insert values in the parent object? Clearly I'm using the wrong syntax. EDITED, getting closer: insert into myTable select mybigtype('foo', 'bar', 'fizzle', myarrayoflittletypes( select ref(S) from anotherTable S where S.stname='dingle' ...

Is there an open-source SQL database that has the concept of Oracle's "rowid" pseudo-column?

I am aware that MySQL and PostgreSQL[1] do not have that concept, so I am interested in finding out of there is an open-source SQL database that does have the concept. [1] It was later pointed out that PostgreSQL does have the rowid pseudo-column. ...

Delete only 500 rows from a table

Hi Friend, Can somebody please, help me with a query to delete only 500 rows from a table which has 20000 rows. Also has to be older than a particular date. Thanks for your help, Soofy ...

oracle9i queries

I am having a oracle table consisting of 6 columns,out of which one is date column. The date field has null entries in some rows...no other field is null.. Can I delete the rows having date field as null? or should I update some value in the date field for those rows...? Please provide me the correct way to do both these operations? th...

SQL Server 2008 Slow Table, Table Partitioning

I have a table that has grown to over 1 million records... today (all valid) I need to speed it up... would Table Partitioning be the answer? If so can i get some help on building the query? The table has 4 bigint value keys and thats all with a primary key indexed and a index desc on userid the other values are at max 139 (there is ju...

When is it appropriate to use NOLOCK?

I am having timeout issues and deadlocks from time to time with some long running queries. I'm wondering when is it most appropriate to use NOLOCK and where? Do I use it on the updates & inserts? or reads? ...

Find Rows whose date range contain a given date

Hello, I am looking at the following problem: My group table contains two fields: ArrivalDate and DepartureDate. Now I want to find all groups who are present at a given date. Eg. the SQL query is passed a date, and I want to find every group where this date falls into the range ArrivalDate to DepartureDate. Thanks a lot! Martin ...

Duplicate rows in Oracle

How can i prevent duplicate rows being selected in a select query? I have a table with the following fields: name type user1 user2 user3 date My query requires me to select data for a particular user only at a time which is entered by the user at front end.. Say user enters 1, then the select query should retreive data for user1 onl...

Recommend SQL data model for Semantic Network nodes?

We're building a RDBMS-based web site for a federal semantic network (RDF, Protege, etc). This is basically a large collection of nodes, each having a large and indefinite set of named relationships to (and from) other nodes. My first thought is a single table for all the nodes (name, description, etc), plus one table per named relation...

GridView + ObjectDataSource issue - equally bad performance for large and small result sets

Hello. I was called to work on an older .NET legacy web app recently. The performance had recently fallen quite sub-par, as the amount of data in the system had quadrupled. Had been fine for the previous 2 years. It was using a .xsd file to talk to a stored procedure that narrowed the results sufficiently (though no paging) and feeding ...

Using Multiple Tables, Multiple Values with Min() SQL

HI, New to StackOverflow... I am using SQLite in an application that I am developing. I am trying to run a pretty complex query (complex for me!!) and I have gotten the basic results i need but I am stuck on getting over the last hurdle. I presently have this query that does what i need it to do... SELECT SUM(activity) FROM activitie...

What is the advantage of using an INCLUDE column with a SQL Server index?

create nonclusterd INDEX index_name ON <object> ( column [ ASC | DESC ] [ ,...n ] ) [ INCLUDE ( column_name [ ,...n ] ) ] [ WHERE <filter_predicate> ] In the above syntax we will specify non-key columns in the INCLUDE,what is the advantage in specifying non-key columns? Please help me. Thanks in advance ...

SQL Server's port is blocked

Developed a Windows application that remotely accesses an SQL Server online. However, the client's ISP blocks port 1433. What are the other options to connect to SQL Server from the windows app? ...

Is it possible to make LinQ "understand" a classic SQL query??

Hi everyone! Is it possible to make LinQ to SQL read and understand a pure SQL query sucha as "SELECT * from myTable"?? My boss asked me to write directly to database the pure SQL querys in a certain table and this table will have a field named "typeOfSelect", for example. And, in my application, I will have to read this field "typeO...

is there something faster than "having count" for large tables?

Here is my query: select word_id, count(sentence_id) from sentence_word group by word_id having count(sentence_id) > 100; The table sentenceword contains 3 fields, wordid, sentenceid and a primary key id. It has 350k+ rows. This query takes a whopping 85 seconds and I'm wondering (hoping, praying?) there is a faster way to find all...

How to combine 2 bit columns

Hello, I am querying a database and I have 2 bit columns I need to combine (for this example if one is true the column must be true). Something like: Select col1 || col2 from myTable What is the easiest way of achieving this? ...

Need help with some SQL

<?php if (isset($_POST['email'])) { $email = mysql_real_escape_string($_POST['email']); $password = mysql_real_escape_string($_POST['password']); mysql_query("INSERT INTO accounts (email, password) VALUES ('$email', '$password')"); } ?> <h1>Create Account</h1> <form action="" method="post"> <table cellspacing="3"> <tr> <td vali...