sql

Multiple Join or subquery query optimization SOLVED

I have this query, which executes in 1 or 2 seconds for a given case: Select Count(*) as qtty From event e Join org o On o.orgID = e.orgID Join venue v On v.venueID = e.venueID Where Match( e.name, e.description ) Against ( $keywords ) And e.site_id = $site_id And e.display <> 0</code> I...

Do you put your database static data into source-control ? How ?

I'm using SQL-Server 2008 with Visual Studio Database Edition. With this setup, keeping your schema in sync is very easy. Basically, there's a 'compare schema' tool that allow me to sync the schema of two databases and/or a database schema with a source-controlled creation script folder. However, the situation is less clear when it com...

Cannot use parentheses when calling a Sub

Hi there, I have a Classic ASP page that contains the following code to attempt a parametised query; <% Set cmdEmail = Server.CreateObject("ADODB.Command") Set rsEmail = Server.CreateObject("ADODB.Recordset") cmdEmail.CommandText = "SELECT * FROM VWTenantPropertiesResults WHERE ContentID = ?" cmdEmail.CommandType = 1 cmdEmail.ActiveCon...

Determine a table's primary key using TSQL

I'd like to determine the primary key of a table using TSQL (stored procedure or system table is fine). Is there such a mechanism in SQL Server (2005 or 2008)? ...

Compare with Dates and ID?

Using SQL Server 2000 I want to get Table2.TimeIn Table2.TimeOut according to Table1.personid and also If Table1.Date = Table3.Date then it should take a Table3.TimeIn, Table3.TimeOut. 3 Tables Table1 ID Date 001 20090503 001 20090504 001 20090506 002 20090505 002 20090506 So on…, Table2 ID TimeIn TimeOut 001 08:00:...

SQL Interpolation: Cubic / Quartic

Hi, Can anyone point me in the direction of an SQL cubic or quartic interpolation function? I'm trying to save the time of a developer at work coding a Crystal Report and I'm keen for him not to have to write something from scratch. A smooth curve interpolation is needed because we're interpolating interest rates. Regards, Andrew ...

Mysql performance and Count(*)

I want to know that my sql execute count queries in linear time or in log(n) time i think that if query parameter was indexed it can do it by cubing ...

.NET 1.1 and SQL Server native Client for SQL Server 2005

Hi All, I have a .NET 1.1 application that currently connects to a SQL Server 2000 database server. This SQL Server is about to be upgraded to a SQL Server 2005 server with mirroring enabled. I have been trying to figure out if mirroring (i.e. automatic failover) is supported by .NET 1.1. I know that it is supported through the SQL Serv...

sql Server error - 3709

Hi I keep getting the error: Error (3709) - /mysite/Pages_Secure/mypage.asp ADODB.Recordset. "The connection cannot be used to perform this operation. It is either closed or invalid in this context.." strQuery = "" strQuery = strQuery + "SET ROWCOUNT 0 " strQuery = strQuery + "SELECT FIRSTNAME, LASTNAME, EMAIL, USER_TEAM_ID, USER_SERV...

SQL Server Table and Column Alias for legacy applications

Having just started working for a new client I have noticed that their database schema could do with a serious overhaul. I've made some suggestions (naming conventions mainly) which would be acceptable for the new suite of applications we are developing going forward, however the system would also have to support the lagacy names used ...

How to create a table of name-value pairs in SQL

Using SQL, how do I convert a single row table like this... Firstname Surname Address1 City Country --------- ------- --------------- ------ ------- Bob Smith 101 High Street London UK ...to a table of name-value pairs like this: Name Value --------- ------- Firstname Bob Surname Smith Address1 101 Hig...

Selecting from a table where field = this and value = that

I have a mysql table that looks something like this: Row 1: 'visitor_input_id' => int 1 'name' => string 'country' 'value' => string 'Canada' Row 2: 'visitor_input_id' => int 1 'name' => string 'province' 'value' => string 'Alberta' Row 3: 'visitor_input_id' => int 1 'name' => string 'first_name' 'v...

How to get first day of the year with SQL?

Hello, I'm working on a purging procedure on SQL Server 2005 which has to delete all rows in a table older than 1 year ago + time passed the current year. Ex: If I execute the procedure today 6-10-2009 it has to delete rows older than 2008-01-01 00:00 (that is 2007 included and backwards). How can I get the date of the first second ...

SQL - Help writing query

Hi, I'm sure how to do this and was looking for some help. In SQL, I need a query that goes like this Get all people Ids who's last order date is larger then x(a predefined date). I've tried using Max() but it doesn't seem to be working right. thanks ...

Oracle material views vs analytic workspaces

In Oracle, what are the pros and cons of using materialized views, and of analytic workspaces? What are the best practices surrounding the use of these features? We have an OLTP system, but would also like to access summary information in reports and interactive decision support tools. ...

Compare with Date and ID problem

Table1 ID Date Intime Outtime A001 20000501 12:00:00 22:00:00 A001 20000502 14:00:00 22:00:00 A001 20000503 12:00:00 23:00:00 A002 20000501 11:00:00 20:00:00 A002 20000502 13:00:00 21:00:00 So on…, Table2 ID Date Intime Outtime A001 20050501 14:00:00 23:00:00 A002 20050501 08:00:00 16:00:00 From the above table I want...

Why do I have duplicate rows for the same subscriber in my MSmerge_identity_range table?

Hello, I have a database with merge replication set up on a SQL 2005 server with 1 subscriber. I am having some identity range issues an I started to look at the MSmerge_identity_range table. I have one subscriber but 2 rows for each. For Example(I shortend the guids but for arguments sake they are the same for each row): subid ar...

dynamically display category, subcategory, products using coldfusion

Hi to all.. please help me with this school project for an e-commerce site that im doing ryt now..im a newbie in programming.. here's the scenario.. Im using coldfusion,ms access,dwcs3 How can I dynamically view the products that are base on dynamic category and subcategory? using URL parameters here is my table on my msaccess tblca...

Get table column names in mysql?

Is there a way to grab the columns name of a table in mysql? using php ...

getting common nodes between two tags

Hi, i have a table with 2 columns tid and nid columns, i need to prepare a report to get common nodes between a tid. i.e table is like (tid, nid) (mysql,2) (mysql,3) (ajax,1) (ajax, 2) now i need to get what what are the common nodes between ajax and mysql which is node2. i am looking for a query or some logic with database query in...