sql

Why there is no any Sql Server in Add Connection list

I use Microsoft Visual Studio 2010 Professional (I installed all components). Here is what I'm trying to do. I create a new ASP.NET project. Then I open Server Explorer (View->Server Explorer), right click on Data Connections and choose Add Connection. Then I choose Microsoft SQL Server and press Continue, but the 'Server name' list is ...

How to install FullText Search on SQL Server 2008

Possible Duplicate: How to install fulltext on sql server 2008? I have recently installed SQL Server 2008 R2 When I tried to create Full Text Search Index Example CREATE FULLTEXT INDEX ON DATABASENAME.dbo.MYTABLE ( column_to_index Language 0X0 ) KEY INDEX myindex ON DATABASENAMECatalog WITH CHANGE_TRACKING AUTO It had giv...

Generating reports, such as income/loss etc

I have 2 tables, purchases and sales with each having a date field and a cost field. I want to generate reports of a few different types, for example I want to show profit and loss over each month or year, or to show how often a particular item sold for a given arbitrary time period ( probably based on user input) Is it terribly comple...

Problem with UTF-8 Encoding on SQLCE

I'm using SQLCE for a database on a local application, I set that the encoding would be UTF-8, this encoding is supposed to accept the "ñ" and "Ñ", but when I save "españa" and after that I do a query to see all the tuples on the table, it shows "espa�a" with that weird replacement character. I was wondering if there's any way I could co...

One to one relationship in Sql Server and LINQ

I have a Users table and a profile table. The reason they are separate is because information about the user can be put in before they are registered for the site. The problem I'm running into is that when I set the relationship in Sql Server it wants to create a one to many relationship. I don't see any way to change this. ...

A study in JOINs with many-to-many relationships

Consider, if you will, the following tables: This may seem like a strange structure, but allow me to explain. The goal of this structure is to create a report listing all people, excluding those on vacation (for simplicity, we'll pretend that the vacation record will only exist if a person is on vacation.) The reason I have the Vaca...

Using NOT IN and count with query

Having problems with A count of the number of customers who have not hired cars create table customer (customer_id char(4) primary key not null, customer_sname varchar (30) not null, customer_fname varchar (30) not null, customer_title varchar (6) not null, customer_address1 varchar (35) not null, customer_address2 varchar (35) null, c...

Can this be written as a query instead of using a function?

Hi folks, I have a table in this format (similar to the class schedule you had in college): create table match_times ( match_time varchar2(20 char), match_sun_day char(1 char), match_mon_day char(1 char), match_tue_day char(1 char), match_wed_day char(1 char), match_thu_day char(1 char), match_fri_day char(1 cha...

SQL for Selecting fix number of row "families"

Hello, Given table | id | user | | 1 | 1 | | 1 | 2 | | 1 | 3 | | 1 | 4 | | 2 | 5 | | 2 | 6 | | 2 | 7 | | 2 | 8 | I want to write a query that will return 3 rows for id=1 and 3 rows for id=2 (order does not matter, yet I would assume that it can be enforced). So the end result should be something lik...

how to select the last three rows of a table in ascending order?

Hi, I want to select the last three rows of a table in ascending order. How the query should be for that? Thanks ...

SQL SUM of distinct rows.... I'm stuck!

Hello, Been trying to put together an SQL query that sorts data into financial years (which I've sorted) and then SUMs it according to each distinct value in the claim_id column table structure is: claim(id, claim_id, date, amount) SQL so far is: SELECT CASE WHEN MONTH(date)>=4 THEN concat(YEAR(date), '-',YEA...

Suitable CMS framework for site projects - advice needed

I will be creating a website soon, and as such I have four projects on the go (or three if you consider the first entry as a full project in itself, not two separate sites): 1 & 2 - Internet radio station 3 - TV episode guide with airdates 4 - News site I will describe each of them, and how I intend to use them: Project 1 & 2 The ...

C# - Generic Lists - Can't Clear and Add all over Again ..

The Problem is .. I have a Set of Lists IDs .. Each one Related to Set of Traffic IDs in the Database .. I wanna Use One List ID for each loop to get that set of TL IDs and store them in a List but in a Class-seem manner ! when I don't add TL_ids.Clear(); at beginning .. all results are added so the final result becomes = Count of all ...

SELECT UNION and ORDER BY in mysql.. how to ?

Hi folks, i would like to get from a single table, all rows, but order them in different ways. For example i write (SELECT * FROM table1 ORDER BY fieldA ASC LIMIT 3 ) UNION ( SELECT * FROM table1 ORDER BY FieldB DESC ) It works, excpet that the second order by (FIELDB DESC) is ignored... Somebody know Why ? Thank you ...

SQL abs calculation - using latitudes and longitudes - MATH!

I've got an sql query that pulls locations from a database based on coordinates within a certain range. Now I'm trying to order them by proximity with a bit of math - but no matter how many times im writing it out on paper I can't seem to figure out a working solution. lets describe a few variables: $plat (the latitude of the place) ...

SQL to GQL - ON DUPLICATE KEY

INSERT INTO {$table_prefix}_players (id, name, v1, p1, r1) VALUES ('$id', '$name', '$villages', '$points', '$rank') ON DUPLICATE KEY UPDATE p7=p6 , p6=p5 , p5=p4 , p4=p3 , p3=p2 , p2=p1 , p1='$points' , v7=v6 , v6=v5 , v5=v4 , v4=v3 , v3=v2 , v2=v1 , v1='$villages' , r7=r6 , r6=r5 , r5=r4 , r4=r3 , r3=r2 , r2=r1 , r1='$rank'" Hi ...

PL/SQL: ORA-00933 command not properly ended

hello Im trying this query: DECLARE v_week NUMBER; BEGIN SELECT WEEK FROM WEEKDESTINATION INTO (v_week) WHERE STARTDATE BETWEEN '02-JAN-2010'AND '09-JAN-2010'; END; but it throws the following error: PL/SQL: ORA-00933: SQL command not properly ended please help ...

Normalization/Schema for classifying cross-browser bugs based on rendering engines and browser versions?

I'm trying to decide on a schema for storing cross-browser bugs across all the rendering engines. Here's what I had in mind: browser_engines table: id name version 1 gecko 1.5 2 gecko 1.7 3 gecko 1.8 4 gecko 1.9.0 5 gecko 1.9.1 browser_versions table: id name version engine_id 1 firefox 3.0 4 2 firefox...

sql - find duplicates in two columns

Hello, I have a table with four columns, where col1 & col2 contain similar values (INT). I now want to know, if there are duplicates in col1 and/or col2. i.e., col1 | col2 -----+----- 111 | 222 333 | 444 111 | 333 555 | 111 → Duplicates: 111 (3x) and 333 (2x). I use sqlite, but I think this is a basic sql question. Thanks, mspo...

Test data update

Just curious if this is the best way of updating the balances? It executes fine but I am new to SQL Thanks for any advice... */ CREATE DATABASE KFF GO USE KFF CREATE TABLE COA ( Account INT NOT NULL, Description VARCHAR(250), Short_Description VARCHAR(250), ) BULK INSERT COA FROM 'C:\COA-IMPORT.TXT' WITH ( FIELDTERMINATOR = ',', RO...