queries

Do you use a query handler? If so, what tasks does it perform for you?

Several months ago my work deployed an in-house function that wraps the standard, php, mysql_query() function with additional options and abilities. A sample feature would be some handy debugging tools we can turn on/off. I was wondering how popular query handlers are and what features people like to build into them. ...

Is it possible to automate MS SQL Server (2005) queries via SQL Server Management Studio?

Hi, I have two queries saved on my SQL Server 2005 and I would like to have them running at certain intervals, e.g. every 24 hours. Is there a way to automate these queries and schedule them via SQL Server Management Studio? Thanks for all the help in advance. Ym PS: New here and have intermediate level knowledge of SQL server ...

LINQ-to-SQL CompiledQuery.Compile() with Update, Delete, Insert?

All, So I've got all my select queries in LINQ-to-SQL converted to using CompiledQueries to speed things up. Works great so far for select statements, but I haven't been able to figure out how to pre-compile insert, update, or delete statements. Granted, when you're inserting, deleting or updating in LINQ-to-SQL, you have to use the o...

Parameterized Queries (C#, Oracle): How to produce a more readable representation?

I am using parameterized queries in my C# code to interact with an Oracle database. What can I do to log the statements in a more readable fashion? Suppose I have a parameterized query like: INSERT INTO PERSON (ID, NAME, BIRTHDATE) VALUES (:id, :name, :birthdate) Ideally I would like to see the log entry with all parameters replaced ...

How to create a dataview In Sharepoint with data from a join query?

I have 3 Lists in Sharepoint. I want to create a dataview that is a join of 3 tables. Table1 is joined with Table2 on FieldA Table 2 is joined to Table3 on FieldB Table1 has duplicate values in FieldA so I need to only return one value to join with Table2. In Access my query looks like this: SELECT DISTINCT WRK_InputWorkOrders.WorkOr...

Hibernate Performance Tweaks

In your experience what are some good Hibernate performance tweaks? I mean this in terms of Inserts/Updates and Querying. ...

Your Favorite LINQ-to-Objects Queries

With LINQ, a lot of programming problems can be solved more easily - and in fewer lines of code. What are some the best real-world LINQ-to-Objects queries that you've written? (Best = simplicity & elegance compared to the C# 2.0 / imperative approach). ...

VS2008 Save Query Results to file/xml

When I use the query designers in VS2008, how do I save the results to a file? The output window is truncating the XML datatype - even if it didn't truncate, it still requires cut and paste to save the results to a file. ...

How do i determine the SQLDBType of a variable to be added to a parameter?

How do I determine which SQLDBType to assign to a parameter depending on the input variable to store in the DB? Is there a GetType equivelant to test with? If IsNumeric(ParameterValue) Then Parameter.SqlDbType = SqlDbType.Float ElseIf IsDate(ParameterValue) Then Parameter.SqlDbType = SqlDbType.DateTime ElseIf IsArray(ParameterV...

MySQL query question

If I have a table with the hypothetical columns foo and bar. bar might have 50-60 distinct values in it. My goal here is to pick say, up to 5 rows for say 6 unique bars. So if the 6 unique bars that get selected out of the 50-60 each happen to has at least 5 rows of data, we'll have 30 rows in total. ...

php & mysql subscribe to search/matching queries

I have a real estate website that has several categories. And i want the users to be able to subscribe via email to a certain list of offers, they can either be offers from a category ... or offers from a search list. How can i store they're subscription the best way in mysql ... and also how do i go about and do the notification. The ...

Querying Terracotta

Is there any way to Query against the objects stored by a Terracotta instance? I am looking for SQL-Like Queries or any way to filter objects based on fields. ...

How can I make two queries in one ?

How can I make this two queries in one ? $query = "SELECT * FROM `amb_prod` WHERE idAmbiente='".$ambId."';"; $result_set = mysql_query($query); while($member = mysql_fetch_array($result_set)){ $query2 = "SELECT * FROM `produto`, `pt` WHERE produto.refPT = pt.ref AND produto.refPT = $member['idProduto'] ;"; $result...

studying nhibernate critieria queries

Is there any other site for studying critieria queries like http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/querycriteria.html ...

Access queries

I have two tables in MS-Access, U and R. I have joined them together and want to compare two fields. However, because there are X Tags in both to compare I am getting X lines. As you can see on ID 4 and 2 there are two tags in each table and they are both the same however because of my query I get four lines back because it compares all...

How much calculation should be done by MySQL?

I am writing an application and using MySQL to return the difference between 2 dates in MySQL should MySQL do this or should I actually let PHP handle it? I also just need the sum of all the results I am getting back should I return them and add them up on the php side or is there a way to add all the results together on the MySQL Serve...

Best way to query a database using an OR statement

I am attemping to create the following sql script into a subsonic query that I can use with a collection: Select * from tableA where tableA.InvoiceID = @Invoice and tableA.VersionID = @VersionID and tableA.ActiveDate >= GetDate() and (tableB.InActiveDate is null or tableB.InActiveDate <= GetDate()) Here is my current code: orders = n...

displaying all rows in a calculation?

I have a MySQL table of correlation data that I need to extract. I am running this query to find the correlation between x and y given the id; however, I need to run x.id=1 against y.id=2, 3, 4, 5... Currently, I am just running the below command multiple times for each pairing. Is there a way to speed up the query so that I can just run...

MySql Group by

Hi all so I have the following table, 't1' id r_id o_id count 1 2 100 1 2 3 100 1 3 5 100 1 4 2 101 2 5 3 101 2 6 4 101 2 What I'm trying to do is, for a given list of r_id's, return the r_id and o_id where the count...

Escaping SQL queries - support for different Database platforms in .Net

Is there a .Net project/dll, that supports escaping of user supplied input to database queries for various database systems? I would like our entire team to standardize and use one module to perform escaping of user supplied input that will then be used in parameterized SQL queries. Ideally, I would like to specify the database system ...