sql

using results from a sql query in a python program in another sql query

hi, sorry for my previous question which was very ambiguous, but i think if i get the answer to this question I can work it out. In the program below i have selected the barcodes of products where the amount is less than the quantity. I want to say, that if the barcodes(in the fridge table) match barcodes in another table(products), set ...

is there a PRODUCT function like there is a SUM function in Oracle SQL?

I have a coworker looking for this, and I don't recall ever running into anything like that. Is there a reasonable technique that would let you simulate it? SELECT PRODUCT(X) FROM ( SELECT 3 X FROM DUAL UNION ALL SELECT 5 X FROM DUAL UNION ALL SELECT 2 X FROM DUAL ) would yield 30 ...

SQL "IF", "BEGIN", "END", "END IF"????

Not a SQL person at all. Have the following code a consultant wrote. First, it makes sure only an elementary school has been chosen - then, after the BEGIN, if the variable @Term equals a 3 we want to do the stuff under that IF statement. Here's the problem. When @Term is not = 3 we still want to drop down and do the SECOND INSERT...

SQL LIKE with no wildcards the same as '='?

I know this is a pretty basic question, and I think I know the answer...but I'd like to confirm. Are these queries truly equivalent? SELECT * FROM FOO WHERE BAR LIKE 'X' SELECT * FROM FOO WHERE BAR ='X' Perhaps there is a performance overhead in using like with no wild cards? I have an app that optionally uses LIKE & wild cards. T...

Spring SP Class generation with or without Eclipse

With Hibernate+Eclipse you can generate POJO classes that represent the tables. You can then wire it all together pretty easily with Spring. However, if you have to interact with stored procedures you have to wrap each one in it's own class(es) -- although this is definitely preferred to standard JDBC it is still a bit cumbersome at time...

C++ SQL Interface

Has anybody produced a C++ wrapper for SQL that allows to interface to flat files or an active DB server or possable an in memory DB depending on run-time configuration. I have seen: SQLite mySQL I am sure there are others. Both of these are really C and though they provide the same functionality there is no common interface (that ...

LINQ to SQL

I am finishing off a C# ASP.NET program that allows the user to build their own computer by selecting hardware components such as memory, cpu, etc from a drop down lists. The SQL datatable has 3 columns; ComputerID, Attribute and Value. The computerID is an ID that corresponds to a certain computer in my main datatable of products, the A...

Database size estimation tool

Is there a tool for estimating the size of a database? I am looking for such a tool, which I can input the estimated tables, row size, data types, indexes and other variables to give me a clue about the size of a yet-non-existing database. I know MS Sql Server Books Online has a good documentation on how to estimate but I don't want t...

What to use for SQL Server instead of "Key"?

Hi! I have a script of MySQL queries that I use and that work. I'm trying to execute the same queries in Microsoft SQL server and there's one thing I don't understand. MySql uses "key" to define a key made up of different fields. What is the way to do the same thing in SQL Server? Thanks! -Adeena ...

Choosing ISAM rather than SQL

Many developers seem to be either intimidated or a bit overwhelmed when an application design requires both procedural code and a substantial database. In most cases, "database" means an RDBMS with an SQL interface. Yet it seems to me that many of the techniques for addressing the "impedance mismatch" between the two paradigms would be ...

Insufficient privileges when creating a trigger for a table in another schema

When I try to create a trigger in schema A for a table located in schema B, I get an ora error : insufficient privileges. What privileges do I need? ...

Left join and Left outer join in SQL Server

What is the difference between left join and left outer join? ...

.NET and Oracle: Joining a table to an empty set of another table

Hi all, I am trying to join tableA with some data to an empty set of another tableB. The main purpose is to get all the columns of tableB. I do not need any data of tableB. I have constucted the following SQL: SELECT uar.*, s.screen_id, s.screen_name FROM crs_screen s LEFT JOIN crs_user_access_right uar ON s.rid IS ...

Divide by zero error in stored procedure

Hi i executed the following stored procedure in .net web application. Then run the application. I got this error " Divide By zero error " Stored procedure: CREATE procedure Details(@Stringtext varchar(8000),@SearchStringtext varchar(100)) as begin SELECT ({fn LENGTH(@Stringtext)}- {fn LENGTH({fn REPLACE(@Stringtext, @SearchStringtext,...

Php/ MySql 'Advanced Search' Page

I'm working on an 'advanced search' page on a site where you would enter a keyword such as 'I like apples' and it can search the databse using the following options: Find : With all the words, With the exact phrase , With at least one of the words, Without the words I can take care of the 'Exact phrase' by: SELECT * FROM myTab...

Fetch two next and two previous entries in a single SQL query

Hi, I want to display an image gallery, and on the view page, one should be able to have a look at a bunch of thumbnails: the current picture, wrapped with the two previous entries and the two next ones. The problem of fetching two next/prev is that I can't (unless I'm mistaken) select something like MAX(id) WHERE idxx. Any idea? no...

Strange SQL2005 problem. "SqlConnection does not support parallel transactions"

Hi. I have a problem that seems like its a result of a deadlock-situation. Whe are now searching for the root of the problem but meantime we wanted to restart the server and get the customer going. And now everytime we start the program it just says "SqlConnection does not support parallel transactions". We have not changed anything i...

List reports with inline SQL in SQL Server Reporting Services?

I have a couple of inline SQL in many of our reports on the report manager. Now I need to do some code change for all of them, is there a way to list all those reports based on the inline SQL and not any SP? Thanks, D ...

SQL: tell whether columns are unique with respect to each other

Suppose I've got a table: Role ---- person_id company_id financial_year How can I tell the following: Whether each person_id occurs at most once per company_id per financial_year in this table If 1. is false, which person_id's and company_id's and financial_year's co-occur more than once Edit 1: Edited to add financial_year col E...

Apache Derby: how can I do "insert if not exists"?

I'm giving Apache Derby, aka JavaDB a spin. I can't seem to get around duplicate key issues when inserting records that may already exist. Is there a Derby equivalent to "insert if not exists", or "merge" ? Similarly, is there a way to do something like "drop table foo if exists"? ...