sql

Query a recordset from an existing query Linq To Sql

I'm in a little bit of a road block here, but what I would like to ultimately do is to create a recordset based off of a query and store the information into separate objects (let's call them Foo) then create a new query to group all the Foo objects with the same id's into an ArrayList into Bar objects. How would I go about doing this in...

One SQL query, or many in a loop?

I need to pull several rows from a table and process them in two ways: aggregated on a key row-by-row, sorted by the same key The table looks roughly like this: table ( key, string_data, numeric_data ) So I'm looking at two approaches to the function I'm writing. The first would pull the aggregate data with one query, an...

Load two related tables in an Oracle database

I've seen many similar questions & answers, but they've used other DB-specific tricks, or done it in code, etc. I'm looking for a straight SQL batch file solution (if it exists). I have two tables with a parent/child relationship, call them Runs & Run_Values. Runs has an "auto" generated PK, runID (a sequency & a trigger), and two colu...

Combine Multiple Fields into One Text Field in SQL Server

So I have a table that looks like this: Name ID TaskID HoursAssigned ---------------------------------------------------------------- John Smith 4592 A01 40 Matthew Jones 2863 A01 20 Jake Adams 1182 A01 100 Matth...

Oracle 8i Query Help

Hi all, I have a table that looks something like this: ID | STATUS | TYPE ---------------------------------------- x123 | A | High School x122 | I | High School x124 | F | High School x125 | A | College x126 | I | College x127 ...

In Classic ASP, are there major performance consequences of having several connections open and close?

I have a code snippet similar to the one below that I would like to refactor into two different functions each with their own connection (for better maintenance): Dim Conn, Sql, RS Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open ConnString Sql = SELECT * FROM CLIENTS Set RS = Conn.Execute(sql) //'Do something with Cl...

What is the appropriate output file from T-SQL query of table that has XML as datatype

I created a batch script that calls a T-SQL file and output it to text file. The T-SQL file contains select statement of a table to get the information of column with XML as datatype. The file will then be sent with either contents as body of email or as an attachment. However, when I open the text file, I see a long list of information ...

Reporting Services Subscriptions won't allow modification of the To: Field

I have a little issue that is causing me a headache. Our Report Server is SQL Ent 2008 on a Win 2008 server. When users that have Report Browser permissions try to set up a report subscription the To: field is grayed out and pre-populated with their username. They cannot change this and it won't deliver to their email address which wo...

Lists and MySQL queries

Would it be possible to run a MySQL query pulling the names of locations from a table, inserting them into a dropdown menu and then automatically generating a URL for each one e.g. blablabla.bla/index.php?location=blablabla every time the page loads? Any help is appreciated. ...

Where can DATEFORMAT and CONVERT be used? (sql server)

Hi, I am running SQL Server 2005 (express). I am trying to use DATEFORMAT and CONVERT in my queries. I am running into problems, so I first wanted to ask if those functions can be used everywhere. I already know they can be used in SELECT. But can they be used in WHERE as well? For example: SELECT * FROM review AS R, section AS S...

use 'between' with varchar (sql server)

Using SQL Server 2005 Express. ( CONVERT(VARCHAR(8), R.reviewStart, 108) between CONVERT(VARCHAR(8), M.meetingStart, 108) and CONVERT(VARCHAR(8), M.meetingEnd, 108) OR CONVERT(VARCHAR(8), R.reviewEnd, 108) between CONVERT(VARCHAR(8), M.meetingStart, 108) and CONVERT(VARCHAR(8), M.meetingEnd, 108) OR CONVERT(VARCHAR(8), M.meetingStart...

Index performance

I have a table called Transactions with the following schema: ColumnName DataType Constraints ---------- ---------- ----------- id int PK (Cluster-Index) details varchar(50) Later on, I add the following two columns to this table: ColumnName DataType Cons...

How do I convert from BLOB to TEXT in Mysql?

Hiya, I have a whole lot of records where text has been stored in a blob in MYSQL. For ease of handling I'd like to change the format in the DB to TEXT .. any ideas how easily to make the change so as not to interrupt the data - I guess it will need to be encoded properly? ...

Sqlalchemy complex in_ clause

I'm trying to find a way to cause sqlalchemy to generate sql of the following form: select * from t where (a,b) in ((a1,b1),(a2,b2)); Is this possible? If not, any suggestions on a way to emulate it? Thanks kindly! ...

Index Maintenance

What is Index Maintenance and how do I do it? How frequently do I have to do it? What are the benefits? This is related to a transaction table which is subject to frequently modifications; all DML operations will be run on that table. ...

Populating Treeview using Linq

I'm playing with Linq-SQL and would like to display my data in a TreeView on a form. I'm also using .net 3.5, if that matters. Now, my question - is there a better way to populate this treeview? The way I'm doing it now is like this (psuedo): for each order { OrderNode = new TreeViewNode for each product in order { Produ...

Is there a defined and accepted standard SQL language?

I remember in college taking a database class where we, the students, were given the ability to choose our Database Management System. Being my first experience with databases I remember being confused that there were different syntax to the SQL statements depending upon which Database Management System used. Up until this class I was un...

Good Resources for Teradata & Business Objects?

Can any one suggest good resources and practice exercises for Teradata and Business Objects and their combination. I have no idea on where to start..I am aware of SQL, database concepts and programming languages like c, php, c++, C#. I need to learn teradata, BO practically. I need to develop applications for reporting data from Teradata...

Performing a query on a result from another query?

I have a the query: SELECT availables.bookdate AS Date, DATEDIFF(now(),availables.updated_at) as Age FROM availables INNER JOIN rooms ON availables.room_id=rooms.id WHERE availables.bookdate BETWEEN '2009-06-25' AND date_add('2009-06-25', INTERVAL 4 DAY) AND rooms.hostel_id = 5094 GROUP BY availables.bookdate Which returns something l...

Determine SQL Server version of linked server

Does anyone here know how i can determine the version of SQL running on my linked server through use of TSQL statements? I am running SQL2005 my linked servers are running a mix of sql2000, 2005 and 2008. ...