sql

When to use recursive table

Hi All, I have a need to build a schema structure to support table of contents (so the level of sections / sub-sections could change for each book or document I add)...one of my first thoughts was that I could use a recursive table to handle that. I want to make sure that my structure is normalized, so I was trying to stay away from deo...

Is there an equivalent of less for SQL*Plus?

Sometimes a query on SQL*Plus might yield too many rows t fit on the screen. Is there some equivalent of "piping to less/more" mechanism that I can do to navigate the results? select * from emp | less ...

If statement does not work

Ok i have this function. what it should be doing it looking for pid in sql and if found skip the function and move on, but I dont think my if statment is working right. function getblogpost(div) { var date = $(div).find('.time').text(); var user = $(div).find('.user').text(); var title = $(div).find('.title').text(); ...

How to get a single row (SQL) with ASP.NET?

is it possible to get a single row in ASP.NET? i always used dataList but this destroys my design with the item template, i need somethink that has no template only the Eval() statements ...

Import selected columns from a CSV files to SQL Server table

Hi, I am trying to import data from a CSV file to a SQL Server 2008 table. Data upload is working, but I want to import only selected columns, not all, and add them to a a new table, of same no. of columns, using the wizard, but its not happening, the wizard is selecting all the columns. So is it possible using wizard that I only impor...

How to implement a multi-user tag *voting* system (i.e. like Slashdot's story tags)

Hey all, This is a question that's a bit different from the typical "how do I make a tagging system" question, which has been thoroughly discussed on SO and elsewhere. I want to crowdsource tagging so you don't have to rely on the owner of each document to completely list out applicable tags. At the same time, I don't want a random sch...

writing "Comparator" in SQL

Hello, I have the following problem: find the highest row in a table A according to the following rules: Table A Columns: V_Date Date, Type int, H_Date Date 1) find the highest V_Date 2) if V_Dates are the same find the row with the highest Priority, where Priority is defined in Table B with columns Type int, Priority int 3) if V_Dat...

How do I connect to the database with a published web application?

I published my website using IIS and now when I browse to my website it is working properly but not connecting to the database so it always shows a login failure. I've checked my connection string in web.config file and it is right. What could be causing this? ...

ER inheritance modeling

A supply farm can have a transportation document. If present it can be one of two types: internal or external. Both documents share some common data, but have different specialized fields. I though of modeling this in a OO-ish fashion like this: In the document table, one of the two doc_*_id is null, the other is the foreign key with...

Retrieve dates from Oracle DB

I'm using an Oracle DB and I'm trying to fetch data from its tables using PHP. One of the tables contains a date column which behaves strange to me. When I open the table in my DB client (I'm using Navicat Lite) I see dates like "2007-11-29 10:15:42" but when I retrieve them with PHP and display the date it says "29-NOV-07". I use a sim...

How to select a record from a many to many table where one id exists in one but not another?

Sorry if that title didn't explain it well. Here is the table... I want to select product_id where it is in either 5 or 6 but not if it is in 7. Maybe I've lost the plot, but I came up with this query SELECT `product_id` , `category_id` FROM `wp_wpsc_item_category_assoc` WHERE ( `category_id` =5 OR `category_id` =6 ) AND `category_...

How to group rows in SQL with more than 2 columns are of the same value?

One of the usages of GROUP BY is to group entries where a specified column is of the same value. How can we group entries if 2 or more selected rows have the same value? ...

SQL Navigator prompts every time I'm closing it

I'm using SQL Navigator that is connected to the Oracle server of our company. Whenever I run a query or two and exit the program, it prompts the following confirmation window: I don't think that I have pending transactions. To close the program, I have to click on Yes or No and this is annoying. I also tried that: I opened the pr...

How to write a SQL to cascadingly accumulate rows of data?

I have a work plan in DB as follows. For instance, the first row means that Team A has 10 hours' work to do in June (SP1006). Team Sprint WorkHours A 1006 10 A 1007 20 A 1008 30 A 1009 40 B 1008 50 B 1009 60 B 1010 70 I want to derive it into the following form to show: at the end of each mo...

curious case of hyphen and dash

I am trying to fetch records from Oracle 9i database whose value are 'FOO - BAR' for a particular column. The 'FOO - BAR' condition values are present in the table, But when I run the query, the results are not coming. After breaking my head for sometime, figured out that there is a difference in the size of the hypen's. 'FOO – BAR' ...

Selecting all values from row based on one distinct column

Hi! I've been browsing the forums a while trying to find a solution to my issue. I have a table in SQL Server 2000 called result with the following data; City Price DepDate RetDate Barcelona 145 2010-05-15 2010-05-20 New York 400 2010-06-20 2010-06-20 Barcelona 160 2010-05-17 2010-05-22 New York 325 2010-05-...

SQL query Help with OUTER JOIN ?

Hi, I have two tables like this. Table1 Column | Type | ---------+------------------+ cod | text | value99 | double precision | Table2 Column | Type | ---------+------------------+ cod | text | value06 | double precision | and i'd like to join them so i'd have somethi...

SQL Server: how to compare two tables

Hi. I have problem with comparing two tables in SQL Server. I have first table [Table1] with text column where I store my content and second table [table2] with column of my keywords. And now I want to compare all my keywords against my content and get a list of keywords with number of occurrences in the content. (clear enough?) ...

Basic SQL join query

I have a few tables: event_type (et), event (e), event_booking (eb), person (p), person_address (p) and address_country (ac) They are joined like so: et <- e <- eb -> p -> pa -> ac Every join has a one-to-one relationship, except the eb -> p link. A row in eb can have a null instead of an id from p. I want to get all bookings, regar...

Conditional Check in Where clause

i have a procedure in which the below condition is to be written in a WHERE clause. How do I do that. itemid is a parameter which can be null. if itemid is available then add it to my where clause,else do nothing ...