DO NOT USE this for questions targeting Microsoft SQL Server, use the tag sql-server instead. "SQL" is an acronym for "Structured Query Language", it is used in relational database management systems (RDBMS) to query, update, delete, and insert data as well as modify the structure of the database. ...

learn more… | top users | synonyms (1)

1
vote
1answer
430 views

Cannot initialize the data source object of OLE DB provider “Microsoft.ACE.OLEDB.12.0” for linked server

I'm trying to establish a linked server from SQL Server 2008 R2 to an Access database. The Access database is not password protected. As I have seen in other posts (specifically this one), this is ...
1
vote
1answer
168 views

Query to determine a count by rolling interval

I'm looking at orders and trying to simulate some messageing that we are doing in the query so that Marketing can get a base line for how many responses they might expect if we changed the interval of ...
1
vote
1answer
57 views

Script to get duration

I am new to PostgreSQL. I am trying to write a query which can give me duration of the time. The fields are in the format yyyymmddhhmmss. In between we will get empty fields for Start_Time or ...
1
vote
1answer
175 views

I would like to query a range of criteria on multiple columns in MySQL

I have 3 columns in a mysql table. I'm using Innodb engine. I want to be able to search for some values on those columns and also anything close to those values. For example : We have 3 columns as ...
1
vote
1answer
509 views

Question about Oracle's interpretation of “host cpu utilization” in v$sysmetric view

I am studying the v$sysmetric view from Oracle and trying to understand what is Oracle's interpretation of "Host CPU Utilization" It says in the metric_unit as % busy/(idle + busy), but what is busy? ...
1
vote
1answer
69 views

Scheduling a backup in SQL Server 2005

I am trying to schedule back up in SQL Server 2005 with management option. I am unable to find database name while scheduling a backup with full option. Database name is not over there in selected ...
1
vote
1answer
488 views

mysql query - how to delete duplicates based on highest int?

I'm running a reverse auction website and I need to delete the duplicate bids and keep only the highest amount . lastPriceBid_rounded is the "amount". The duplicate is defined by the userId. ...
1
vote
1answer
158 views

Mysql query - find out 1000th row from a table for each user

Lets say I have a table where we log activities of user, I need to find out created_at of the 1000th activity of each user.. Following query works fine for one user.. select `created_at` from ...
1
vote
1answer
53 views

Should I update to sql server 2008 sp2 before restoring the db's or do the update after?

I'm making a move from SQL Server 2008 to SQL Server 2008 R2 (Azure VM) as part of a hosting provider switch (from MyHosting to Azure). Should I update the VM to R2 SP2 before restoring the db's or do ...
1
vote
1answer
548 views

Installing Full Text Search on SQL Server 2008 R2 Express

I can't for the life of me install full text search on my SQL Server 2008 R2 instance. Every installer I have tried shows me this: I've tried: SQLEXPRADV_x64_ENU.exe SQLEXPRWT_x64_ENU.exe ...
1
vote
1answer
202 views

Query for localization app

Here are my tables: mysql> SELECT * FROM locale; +-----------+---------+ | locale_id | value | +-----------+---------+ | 1 | English | | 2 | Deutch | | 3 | French | ...
1
vote
1answer
592 views

MySqli - select from db based on time difference with CURTIME() or SUBTIME()

I have a db with some customers data. There I store their last login time as datetime. I want to run a cron php script every min which will query mysqli for their last login datetime and if that was ...
1
vote
3answers
249 views

How can I best combine 3 queries into 1?

I need the following queries combined into one query that returns the following from all results from the first query you see below (Right now I load the first query into an array in php then run two ...
1
vote
1answer
372 views

How to delete and create user remotely on SQL Server 2000

My boss wants to make sure that no one runs a job accidentally so we are setting up lots of safeguards to ensure that no one sleepwalks, log into the system and run a job. We are updating the ...
1
vote
1answer
232 views

Storing Different Products and Joining on table Names

I am setting up a database using mysql to store different products with different product types. For example I could have Books, Software and clothes etc. What I am think of is creating a parent ...
1
vote
1answer
156 views

cloud computer to speed up sql big data queries?

i have been doing a lot of data mining at my new job. we collect TONS of data, and it's my job to visualize that sea of information in real time with statistic/heuristic analysis. we're currently ...
1
vote
1answer
261 views

Delete word, its meanings, its meaning's example sentences from DB

I have three tables as below (simplified for demonstration): words ===== integer id text word meanings ======== integer id integer word_id text meaning examples ======== integer id integer ...
1
vote
1answer
154 views

Setting up simple relational database structure

I'd like to set up simple MySQL database but I'm a bit confused about everything, so let me try to explain... I have 4 relevant tables, let's call them POS, POS_STRUCT, POS_STRUCT_DIV and MEMBERS. ...
1
vote
1answer
259 views

Group activities in activity feed by users and products

On my website I'm building an activity feed where I got the basics done and are now making some improvements here and there. One of them is the grouping. I've built it so that if multiple users buys ...
1
vote
1answer
320 views

How to re-arrange rows to best fit within groups?

I categorized a table with the method introduced here to categorize my items to folders with a limit size of 100. mixing_order id num_items cat order_in_cat cumulative_sum folder 1 ...
1
vote
2answers
299 views

Automatic create SQL database and table relationship

For SQL Server 2008, what is the best way to automatically "draw up" the Database relation ship and table relationship too? Is there any way to visualize database with this.
1
vote
1answer
97 views

How to aggregate datapoints in a table?

Suppose I have following table - CREATE TABLE data_points (t DATETIME PRIMARY KEY, value INTEGER); I want to aggregate the data by calculating average of every 10 points in the table. i.e. If ...
1
vote
1answer
233 views

SQL Server - Ignoring object dependencies to copy a DB (despite some column referenced in a sproc no longer existing)

First of all apologies for the novel but there's a lot to explain... We have over 100 databases for our product, 1 per server, each of which has variations on other ones (ideally they should all be ...
1
vote
1answer
119 views

Does Microsoft Security Bulletin MS11-049 affect SQL Server 2008 SP3?

The security bulletin does not list SQL Server 2008 SP3 under affected software but it came out prior to that service pack. We are running SP3 but this issue is still showing up on a vulnerability ...
1
vote
1answer
578 views

How to create sql query results in columns from rows?

From the following tables: store(store_id, ...) {1 ..., 2 ...} two stores film(film_id, ...) inventory(inventory_id, film_id, store_id) rental(rental_id, rental_date, inventory_id, return_date, ...) ...
1
vote
1answer
77 views

Slave as a master in PostgreSQL [closed]

I have set up a hot standby in PostgreSQL 9.0 on Windows. I want that, at the time of fail-over, the slave should take over the role of master and start performing operations (both read and write) ...
1
vote
2answers
271 views

correct security and user setup for SQL Server database

I am currently on setting a sql server database on a database server. A front end web application running off a web server communicates to the database. What is the best approach for setting up users ...
1
vote
1answer
233 views

GROUP_CONCAT with ORDER BY , but results are not ordered

The following query works fine SELECT *, (SELECT GROUP_CONCAT(url SEPARATOR '$$' ) FROM project_photos WHERE project_id = projects.id ORDER BY priority) AS images FROM projects WHERE catID = 2 LIMIT ...
1
vote
1answer
71 views

System test Database user management

We are in development stage and to be able to give the developers an integration test environment, we need to give them access to the database, they can share and test their code in the system ...
1
vote
1answer
40 views

Order questions depending on answer votes

I'm really curious about how to create an SQL query to order questions depending the votes_up and votes_down. (The votes can be the sum of both, votes_up + votes_down.) Question has_many answers ...
1
vote
1answer
720 views

How to import big sql file in Phpmyadmin

I am having a big sql file( 16mb) and all i need is to upload it to the Phpmyadmin to work with it in my localhost. I'm a newbie here in Php/MySql and i want to know about the details regarding the ...
1
vote
4answers
4k views

Select from linked server to local server causing waits on both sides

The queries in question are here: http://pastie.org/4833351 Run individually, each of these queries runs through (albeit slow). Run as a group, it just sits there, showing either OLEDB waits on the ...
1
vote
1answer
1k views

Convert spatial points data to line data for use in Line Layer in SQL Server Reporting Services (SSRS)

I have a query that returns the fields Order, Lat, Long, SpatialData, <OtherStuff>. SpatialData is a point. I want to create a line layer that draws lines between my points based on the order ...
1
vote
1answer
148 views

Does MySQL compress the stored data?

When I export a database in MySQL, it gives me a .sql file. Let's say this .sql file is 80 MB. Are they compressed in order to reduce disk space usage? Is that 80MB real physical-storage size?
1
vote
1answer
471 views

Can I install sql server on Win XP machine with user profile on D drive?

Is it possible to install sql server on a windows xp machine where the user profiles are created on a non system root directory, that is, on D drive rather than C drive? I am trying to install SQL ...
1
vote
1answer
1k views

Production SQL Server High CPU for a Single Query

I have a single query which is consuming a larger amount of CPU than I would expect in SQL 2008. I am not able to determine why the CPU is spiking for this single query. I can trigger an ...
1
vote
2answers
272 views

User-defined sort order for a query

I'm storing user preferences for sort order in a table: $queryHistory = "SELECT orderby,ascdesc FROM user WHERE UserID= ".$id; $resultHistory = doQuery($connection, $queryHistory); $numHistory = ...
1
vote
1answer
169 views

Get and count all blog posts and all users that fits a LIKE condition (two sepparated queries)

I've this tables: -- -- Table structure for table `default_cmvblog` -- CREATE TABLE IF NOT EXISTS `default_cmvblog` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(100) COLLATE ...
1
vote
1answer
105 views

group by and having query need help?

I am using the pub database in SQL Server 2005. Which stores have at least 5 orders? Should diplay the store name and store id. I have come up with a query something like this: select ...
1
vote
1answer
1k views

Unable to add records to query in Access 2007

I've found this excellent resource that covers why a query might be read-only. I have a query that is not read only, yet I'm unable to add new records to it. There are three tables. Let's call them ...
1
vote
1answer
44 views

What is this type of query called, and how can I formulate it?

I have following tables: events(event_id, name, description) groups(group_id, event_id, title, description) event_group(event_id, group_id) users(user_id, name, email) ...
1
vote
1answer
3k views

Combine column from multiple rows into one row in SQLITE

I have a sqlite-database with the schema Articles Id Name Tags Id Name ArticlesTags Id ArticleId TagId I´m trying to query for Articles.Name and a LIST of tags. Basically what I would want ...
1
vote
2answers
119 views

Wordpress- changing all subscriber passwords query [closed]

I'm trying to mass change (120) subscriber passwords. The passwords are stored in table wp_users but I need to change the password based on information from another table wp_usermeta where it has ...
1
vote
1answer
42 views

Get wall_post and profile data for several users

I'm trying to build a query for fetch wall_posts and profile fields for several user_id. First see the images at: http://www.dropmocks.com/mBjQ7P. The table with id_user_rq, id_user_ap is the table ...
1
vote
1answer
114 views

How to get non-deleted messages for one user_id if the same user_id appears in two tables at same time?

I'm trying to get non-deleted (deleted = 0) messages for one user_id if the same user_id appears in two tables at same time, but something is wrong because I am not getting the correct or expected ...
1
vote
1answer
728 views

SQL Database to XML?

I would like to export SQL data to an XML file so it can be read in COBOL. I am working with SQL Express 2008 r2.
1
vote
2answers
3k views

Error while importing a “.sql” file in database

I am trying to import a .sql file in to my local database. whenever i type the command to import the file, I get an error ERROR at line 1: Unknown command '\S'. This is the first line of the sql file ...
1
vote
1answer
213 views

MySql - How can I improve this query?

I have the following table: http://pastebin.com/XH6FvhZ8 and the following query: SELECT * FROM (SELECT * FROM `job_logs` ORDER BY id DESC) AS job_logs_tmp WHERE (job_logs_tmp.user_id = ...
1
vote
1answer
408 views

Migrating data in SQL Server from source to target with schema change at target

We have a strange scenario. We have a source database running on SQL Server 2005 where we push data to a target database running on SQL Server 2008 R2. The source database table has 5 columns. The ...
1
vote
1answer
2k views

pg_restore: [archiver] unsupported version (1.11) in file header postgresql

My server is working on Ubuntu with PostgreSQL 8.4 and the development machine I'm using has Debian Lenny with PostgreSQL 8.3. My machine can't be upgraded to PostgreSQL 8.4 and I need to restore a ...