sql

How can I refer to the row that the update is currently updating?

TABLES: student(name,points) playsin(name->student(name), score) I'm trying to use: UPDATE STUDENT SET points = points + CONSTANT * (SELECT score FROM PLAYSIN WHERE playsin.name = student.name); ...

How to enclose values in SQL commands?

An error-free column name syntax is [My Column] instead of My Column which causes an error. An error-free string value syntax is '25,00' instead of 25,00 which causes an error. I'm getting an error using single quotes to enclose values, if the column data type is numeric. Are there any other ways to enclose values safely for string or ...

Can MySQL use indexes over 2 different storage engines?

I have a myisam table and a innodb one. The innodb has an index on a foreign key from myisam. Can MySQL use that index when performing joins? ...

Debugging Paging in Sql Reporting Services

I'm working on my first significant Sql Reporting Services project and am having problems with paging. Most of the reports are already working. What is happening is that I"m getting different numbers and locations of page breaks between Web Reportviewer, PDF and Word documents. The word is the closest, but none of the three are really...

C#/SQL Get all Stored Procedures and their Code

How can I obtain all stored procedures and their code from SQL Server? I need to show data that is similar to what SQL Server Management Studio shows, incl. allowing to browse through SP's with code, tables and indexes. Any hints on how to get this information out of SQL Server? P.S., I'm using C#. ...

Difference between 2 indexes with columns defined in reverse order

Are there any differences between following two indexes? IDX_IndexTables_1 IDX_IndexTables_2 If there are any, what are the differences? create table IndexTables ( id int identity(1, 1) primary key, val1 nvarchar(100), val2 nvarchar(100), ) create index IDX_IndexTables_1 on IndexTables (val1, val2) GO create index IDX_IndexTab...

SQL with 0 counts

I have the following sql query : SELECT DATE(procedures.start) date, name, COUNT(procedure_types.id) count FROM `procedure_types` LEFT OUTER JOIN procedures on procedure_types.id = procedures.procedure_type_id WHERE (DATE(procedures.start) = '2009-10-24') GROUP BY DATE(procedures.start), procedure_types.id ORDER BY DATE(procedures.sta...

ASP.net using label.Text in select query

I have to run a SQL query using a text value in a label and then run that query and bind data to a gridview. Here's my code in VB.net Dim myConnection As SqlConnection = New SqlConnection Dim ad As New SqlDataAdapter Dim details As New DataSet Dim detailcmd As New SqlCommand("select student_name,student_id from students where student...

Help with another mysql query

I Would like to select the count of the newly added DISTINCT product_id in the table ID product_id 1 abc 2 abc 3 cat 4 dog 5 dog 6 man 7 man 8 bat 9 bat 10 abc 11 cat 12 dog 13 dog I want a query that gives me a similar result from the above table - dog -2 c...

Insert rownums in mysql table via query or script

Hey! I have a table that has 5 fields and has a total of 400 records. I added a new field which I called 'order' which, as the name suggests, is to keep an order in the records. Since I added this after the records had been inserted I was wondering if there was a way to populate this field with the current order of the records using so...

What does Oracle error "ORA-17432: invalid options in all7" mean?

I got the following SQLException: "invalid options in all7" Upon googling the error message, the ONLY hits I saw were Oracle error lists which pinpointed the error at "ORA-17432: invalid options in all7". Sadly, googling for the error # brought up only combined lists with no explanation for the error, aside from this page that said "A T...

Get Started with Oracle Express Edition?

Hi! I'm novice in oracle.I'm using oracle express 10.2.0 but i don't know how to create my own database and where my database is created.(The path of my new database). ...

How to look up Language ID of messages?

How do you look up a list of language IDs available within SQL Server? I am specifically looking if there are any views within sys schema. ...

Modifying an SQL query to exclude particular dates

Hey everyone, I have a pretty long SQL query that I use to, for all of the users in a particular "region", for a given month, calculate the number of days that they have been on "duty". This is broken down into weekends and weekdays. Here is the php/SQL statement: $result = mysql_query(" SELECT fname, lname, MONTH( eventDate ) AS MO...

LINQ vs SQL while working with RDBMS

Can I absolutely abandon SQL if I choose LINQ? If Yes, then, Should I absolutely abandon SQL if I choose LINQ? After making a connection to RDBMS using DataContext-class, do I actually need SQL? ...

SQLite3 for Serialization Purposes

I've been tinkering with SQLite3 for the past couple days, and it seems like a decent database, but I'm wondering about its uses for serialization. I need to serialize a set of key/value pairs which are linked to another table, and this is the way I've been doing this so far. First there will be the item table: CREATE TABLE items (id ...

Get a set of date/time ranges based on DB data

I've got a SQL 2005 DB full of activity records that include a DateTime column, a DeviceID, and various bits of data. I need a query that will give me a list of date/time ranges based on DeviceID (possibly limited by a start/end time). Also, I would consider a new range as starting at least 60min after the old one ended (if it's less tha...

How expensive is SqlCommandBuilder.DeriveParameters?

What is the cost of calling SqlCommandBuilder.DeriveParameters? I understand that a round-trip is required to the DB server to get the parameters. After this is called, will the information be cached by the provider, or will it be re-queried EVERY time this method is called? ...

how to select first N rows from a table in T-SQL?

Is there any way to select, for example, first 10 rows of a table in T-SQL (working MSSQL)? I think I saw something in Oracle defined as rownum meta variable, used in a following way select * from Users where rownum<=10 But what about MSSQL? ...

Simple DB design question -- sets of measurements

Hi all, I have multiple sets of measurements. Each set has multiple values in it. The data is currently in a spreadsheet, and I'd like to move it to a real database. In the spreadsheet, each set of measurements is in its own column, i.e., 1 | 2 | 3 | ... 0.5 | 0.7 | 0.2 | ... 0.3 | 0.6 | 0.4 | ... and so on. If I have, say,...