sql

Slow Update Statement

Hi, we're dealing with a very slow update statement in an Oracle project. Here's a little script to replciate the issue: drop table j_test; CREATE TABLE J_TEST ( ID NUMBER(10) PRIMARY KEY, C1 VARCHAR2(50 BYTE), C2 VARCHAR2(250 BYTE), C3 NUMBER(5), C4 NUMBER(10) ); -- just insert a bunch of rows insert into j_test ...

SQL query question: SELECT ... NOT IN ...

I am sure making a silly mistake but I can't figure what: In SQL Server 2005 I am trying select all customers except those who have made a reservation before 2 AM. When I run this query: SELECT idCustomer FROM reservations WHERE idCustomer NOT IN (SELECT distinct idCustomer FROM reservations WHERE DATEPART ( hour, insertDate) ...

How do I view a property in H2 SQL

How does one view a property with a SELECT query? I've got some properties that I need to see the value of in a running H2 DB. I've got the Console app up and running. ...

SQL to LINQ Tool

Is there a tool out there which can convert SQL syntax to LINQ syntax? I just want to rewrite basic queries with join, etc, to LINQ. It would save me a lot of time. Cheers! ...

Partial Keyword Searching (MS SQL 2005)

Current, I've got a stored procedure that has a main goal of doing a full text search through a database table of films and tv shows. In order to get it to do partial-keyword searching, I added some code in SQL to split up the search query by spaces, and output a statement like the following: ' "batman*" ~ "be*" ' The original string,...

Way to tell SQL Server to only cache certain types of adhoc queries

Is there a way to tell SQL Server to not cache certain types of plans? For example, if you have a large number of users queries coming from SQL Server Management Studio, is there a way to tell these to not be cached in the plan cache, thus taking up memory and other resources? Are there other behavioral tweaks that you can do to preven...

Tool to find out why an SQL select does not return any data.

Is there a tool which tells you (or gives you a hint) why a particular select statement dose not return any rows given the current data in your database. eg if you had the following 4 table join select * from a, b, c, d where a.b_id = b.id and b.c_id = c.id and c.d_id = d.id If there were rows which satisfied the conditions a.b_id ...

How do I find out when a stored procedure was last modified or compiled?

I think the question title pretty much says it all, I'm preferably looking for a PL/SQL query to accomplish this, but other options might be useful too. ...

MS SQL Trigger update call dead lock?

I have two tables. Club and Coach. Between them is 0,1 - 0,1 relationship (coach can have zero or one club. club can have zero or one coach). When I want to change the coach of the given club, i have to update the club table. So i have to change idCoach of that club. Lets consider a new coach (the newly assigned coach of the given club) ...

How do you programatically identify a stored procedure's dependencies?

Is it possible to write a PL/SQL query to identify a complete list of a stored procedures dependencies? I'm only interested in identifying other stored procedures and I'd prefer not to limit the depth of nesting that it gets too either. For example, if A calls B, which calls C, which calls D, I'd want B, C and D reported as dependencies ...

Way to select rows which fall on a specific day?

Is there a way in MySQL to select rows which fall on a specific day, as in Mondays, using a date column? ...

A strange SQL join

Simplified for example, I have two tables, groups and items. items ( id, groupId, title ) groups ( id, groupTitle, externalURL ) The regular query I'm goes something like this: SELECT i.`id`, i.`title`, g.`id` as 'groupId', g.`groupTitle`, g.`externalURL` FROM items i INNER JOIN groups...

MS Access Math

Hi, I've got a table in MS Access 2007 with 4 fields. Labour Cost Labour Hours Vat Total How do I multiply 'Labour Hours' by 'Labour Cost' add the 'VAT' and display the answer in 'Total' Where would I put any formulas?, in a form or query or table ? Many thanks for any help Scott ...

How to bulk-amend the job step command in ALL sql server agent jobs

I have many jobs that have a step to send 1 specific email out to a list of people. That list of reciepients is hardcoded in the step command and I need to remove one person from that list, in all jobs. How do I loop through ALL the jobs in the Sql Server Agent and modify the command text to find+replace a specific piece of text. I ...

Subsonic Join issue

For those of you who are decent with subsonic! TblNewsCollection col = new Select().From(Tables.TblNews) .InnerJoin(Tables.TblContent) .Paged(currentPage, pageSize) .OrderDesc(TblContent.Columns.PubDate) .ExecuteAsCollection<TblNewsCollection>(); The a...

Querying data from different tables

I am using a query like this on my postgres database, SELECT TableA.id FROM TableA , TableB WHERE TableA.id = 100; Each TableA.id is unique (its an autoincrement), I am gettting more than 1 result. Am i missing something in here? ...

Sql Server Dependencies

Is there an easy way to chase down table/stored procedure/function dependencies in Sql Server (I'm using 2k5)? I've inherited a giant application with lots of tables and even more stored procedures and functions that are long and interlinked. At the end of the day is there a way to build a dependency tree? Ideally what I'm looking f...

SQL Action keyword

What does the SQL Action keyword do? Can I use this keyword in a trigger and determine if the trigger was called by an Insert, Delete or Update? ...

ORACLE SQL: Need to sum two values, but one may not exist... Is this possible?

I've been running into some problems duplicating some old ASP files into some newer .NET 2.0 code. One of the tasks is to merge the 4-5 SQL statements into one. While I have done this and had some success in performance boosts, Oracle is a new bag for me. This problem however surpasses my own SQL skills as I haven't done this before. Ba...

SQL query help with bridge table

I'm working with a existing database and trying to write a sql query to get out all the account information including permission levels. This is for a security audit. We want to dump all of this information out in a readible fashion to make it easy to compare. My problem is that there is a bridge/link table for the permissions so there a...