0
votes
1answer
1k views

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Attempting to install Drupal 7.16 (also attempted 7.12) onto my local machine, I get the following error at the database stage. SQLSTATE[42000]: Syntax error or access violation: 1071 Specified ...
1
vote
1answer
2k views

How to COUNT number of rows with LIMIT?

I want to catch X rows, thus, I set LIMIT X; but how can I simultaneously count the total number of rows too? Currently, I use two separate queries to do so as SELECT COUNT(*) FROM col WHERE CLAUSE ...
4
votes
6answers
31k views

Download SQL Server profiler for SQL Server Management Studio

How can I profile a SQL Server 2008 database to see code that's being executed on a particular database? I remember using the SQL Server profiler, but I don't see it in SQL Server Management Studio ...
-1
votes
2answers
395 views

Insert ignore with conditional

I need to insert some records which might have duplicates. Column to overwrite/skip is mytable.email and mytable.fooFlag should be 1. I came up with something like this: INSERT IGNORE INTO mytable ...
1
vote
0answers
4k views

Could Oracle ORA-08103 'object no longer exists' error be caused by size of undo_retention parameter?

Had a once-a-day long running data warehousing procedure that I had written that was failing about 50% of the time. Logs were showing ORA-08103 'object no longer exists'. ORA-12012: error on auto ...
0
votes
1answer
130 views

MySQL query optimization

I'm quite new to big MySQL queries (I used to extract raw data from tables then manipulate them with PHP) so I'd like to know if my query below is too "heavy" or slow for some reason (it seems to be ...
4
votes
1answer
993 views

MERGE with OUTPUT doesn't seem to be doing the right thing

I'm adding a foreign key to a table, and removing any rows that violate the FK, copying them into a ModifiedTable_invalid table. As part of the script, I've got the following MERGE command: MERGE ...
0
votes
1answer
391 views

Average, between specific date/time, of the difference between current field and previous field

Im trying to calc the average, between a specific date/time, of the difference between the current field and the previous field. At present ive got a query which displays this but im unsure how i can ...
3
votes
2answers
640 views

Save history editable data RDBMS

I want to make application like testing system. Every question has one or many variant of answers (and one or many can be right). I apologize that tutors and students use my testing system. It means ...
0
votes
0answers
136 views

can not insert big data to mysql database [closed]

I am trying to save big data to database I extend the max_allow_packet and post_size but nothing happened. the code and database released to production server and to stage server on production server ...
3
votes
3answers
1k views

Best practice for a DBA to login to a database

I've read that a DBA never should login to a database as system user. That makes me wondering... how should a DBA login to a database? Should he/she create a DBA account and use it for login purposes? ...
3
votes
1answer
48 views

MySQL Help with Desktop Based Administration

I am making a MySQL based database for a professor and she would like to have a version uploaded to the web and a version on her desktop for personal use. The web version would be "official" whereas ...
7
votes
5answers
12k views

How can I get the correct offset between UTC and local times for a date that is before or after DST?

I currently use the following to get a local datetime from a UTC datetime: SET @offset = DateDiff(minute, GetUTCDate(), GetDate()) SET @localDateTime = DateAdd(minute, @offset, @utcDateTime) My ...
1
vote
1answer
1k views

Performance of SQL Server Triggers

I'm coming from an Oracle/PostgreSQL background and have a hard time coping with the limits of SQL Server's trigger implementation. I want to update two different datetime columns if the value of a ...
5
votes
3answers
455 views

Database Indexing - Maintenance Jobs

I have created a script that runs every night to rebuild & re-organize indexes based on the fragmentation, Indexes with Fragmentation > 30% are rebuilt, Indexes with Fragmentation 10% - 30% are ...
0
votes
1answer
79 views

Max and group by query help [closed]

We have query as below. What we need is to select particular training with latest date and only single data but now when we run the query below we get more then one results. SELECT ...
-1
votes
1answer
29 views

Previous day of last day

I have a table of Promotion where a employee has given four promotions. I want to find out the previous promotion (3th) of last promotions date .
4
votes
2answers
433 views

Best practise for copying a database from production

Currently after releasing a new major or minor version of our application, we take a copy of the production database and perform the below process: Copy production database to test server Obfuscate ...
1
vote
1answer
63 views

“max_packet_size” variant in SQL Server

I am wondering if there is a SQL Server "version" of the MySQL max_packet_size parameter. Is there a way to configure this setting in SQL Server?
0
votes
3answers
406 views

Pivoting row contents to produce one dimensional result

I have a table with a varchar column containing pipe-delimited values For example: Row 1 Column 1 = a|b|e|gg|foo Row 2 Column 1 = oV|foo|do Row 3 Column 1 = boop How can I query this to return ...
2
votes
1answer
390 views

Restore database from individual datafile backups

I had a script that backs up all the individual datafiles like: RMAN> BACKUP AS COMPRESSED BACKUPSET DATAFILE 'datafile<1>.dbf' So i have backupsets of all the datafiles. I'm confused as ...
3
votes
1answer
584 views

Tricky selection of grouped rows, selecting based on values of two distinct but related rows

Say I have a table with the following information (sorted here for display purposes) taskid | reference | centreid | date_out --------------------------------------------------- 10001 | ...
0
votes
1answer
683 views

Massive update to Clob fields oracle 10g

I need to remove a string of characters from 2000+ clobs fields in oracle 10g. How would I do this in PL/SQL? For example, in table t1 there is a clob field called VBase that needs to have the ...
3
votes
3answers
199 views

PostgreSQL equivalent of SQL Server SQL_VARIANT_PROPERTY

Does PostgreSQL have an equivalent function for determining column metadata? Reference: SQL_VARIANT_PROPERTY pg_typeof() appears to be close, but it does not show the precision and scale. Looking up ...
1
vote
1answer
241 views

Does my design adhere to 3NF?

I created this schema with OpenOffice. Does this design adhere to 3NF ? (A relationship link between Equipment and Supplier_Equipment , Customer and Membership should be created but OpenOffice ...
2
votes
1answer
782 views

Enable autocomplete in an sqlite3 interactive shell

I am using sqlite3 on a machine where I can use tab completion (ie .read abc<tab> will autocomplete to .read abcdefghij.db. I would like to know how to enable this on my personal machine. Edit ...
1
vote
1answer
161 views

How to measure improvement after splitting tablespaces into multiple disk volumes? (Oracle 10g AWR)

I have a recently released 10 000 user analytical application that is suffering from performance issues because of excessive amount of transactions. Apart from re writing many of the SQLs in the ...
0
votes
0answers
112 views

Database (open source) for complex queries (for analytics) like these:

In an app, I'll be storing information about events, specifically, session_id url time type data: foo: bar bar: foo The data will basically be a hashmap (need to support arbitrary types / names ...
1
vote
0answers
213 views

Sybase anywhere sql server connection problems

in my work we have a software system based on sybase adaptive server any where version 6 installed on a windows server 2008. the system work fine but after a period of time from system start problems ...
1
vote
0answers
80 views

MySQL: Assessing performance of a query by using EXPLAIN

It is said that the number of rows are scanned is smaller the performance is higher when use Explain to optimize query. So I wonder When the EXPLAIN output includes many rows, is there any formula ...
1
vote
2answers
77 views

How to Handle Database for Application which Starts from Scratch Annually

I am working on an application which will be used by an organisation annually, however each year they will be starting from a clean sheet. Which of the following two approaches (or any other approach) ...
1
vote
1answer
520 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, ...) ...
3
votes
1answer
279 views

Postgres Plus Cloud Database on AWS for write heavy social game?

I'm one of four founders of a big social gaming iPhone app in Sweden. We now suffer from severe database server issues so I'm turning to you guys to get some help. First of all, let me get this out ...
2
votes
3answers
2k views

How do i subtract a number of days from a prepared statement parameter in db2?

I have a C# application using OLEDB to connect to a DB2 database. Basically, I want to do this: SELECT CALC.WEEK, COUNT(CALC.ID) AS TRANSACTIONS , SUM(CALC.SUBTOTAL) AS REVENUE FROM ( ...
1
vote
2answers
640 views

How do I remove duplicate entries in a given timeframe?

My table looks like this: +-----------+ | id | <- primary key | time | <- DateTime | row2 | <- varchar | row3 | | ... | +-----------+ I want to remove all ...
1
vote
1answer
135 views

Simple Slow Query Not Using Indexes

I have a slow query running on a large forum. The EXPLAIN synopsis: mysql> EXPLAIN SELECT COUNT(post_thanks.id) as thanked, post_thanks.postid, post.title, post.dateline FROM ...
1
vote
1answer
3k views

Derive Attributes in Tables?

I have designed my ERD. It has derived attributes. When it comes to relational data modeling using relational schema, I've designed my tables and linked everything properly. I don't know if I should ...
3
votes
2answers
1k views

transactional replication, failing with communication link failure half way through bcp

I am trying to replicate to a 4th subscriber on a remote site. 3 subscribers work fine locally. the other difference is this is a 2012 subscriber from a 2008 r2 publisher and remote distributor. When ...
2
votes
2answers
9k views

Single sql query to select a record from parent table only if all it's records in child table has values

I've Table1 and Table2, Table1's PK is the FK of Table2. Now i need to perform a select from Table1 if and only if all the records in Table2 corresponding to a Table1 record has values (if any field ...
3
votes
2answers
709 views

SQL ANSI JOIN precedence

I have a query that looks like this: SELECT * FROM TBLA A LEFT JOIN TBLB B ON A.Col1 = B.Col2 RIGHT JOIN TBLC C ON B.Col3 = C.Col4 JOIN TBLD D ON C.Col5 = D.Col6 In which order ...
1
vote
1answer
1k views

MySql: #1221 - Incorrect usage of UNION and ORDER BY

I have the following query which is intended to retrieve the newest 3 comments for each post in an array of posts. SELECT * FROM comment AS tbl WHERE sscm_id IN ( SELECT sscm_id FROM comment AS t1 ...
4
votes
3answers
285 views

Storing date increments in tables

I'm working on a ASP/MS SQL project that performs a lot of calculations based on dates and time. In one case, the system will lookup a value based on the nearest half hour increment throughout the ...
2
votes
1answer
5k views

Joining 3 tables using SQL Query?

I'm having problems joining three tables. It works well when I use the same query for joining two tables (after removing LEFT OUTER JOIN C ON B.No = C.No). However, it doesn't work when I use three ...
1
vote
2answers
696 views

sql server removing service_queues

Hi when i query select * from sys.service_queues in sql server 2008 sp3 i am getting InternalMailQueue ExternalMailQueue _LakeSide_DbTools_DeadlockQueue QueryNotificationErrorsQueue ...
3
votes
3answers
1k views

Empty LONGTEXT or NULL?

In my MySQL DB I have one field called html_contents that contains all the html to be shown in a webpage. Obviously the html could be huge, and certaintly bigger than 64KB, therefore I decided to use ...
2
votes
1answer
2k views

SQL Server upgrade single instance

I have a server that is running SQL Server 2005 Express. It currently has 2 instances of SQL Server running. Instance 1 runs some old legacy software that is not supported by me. Instance 2 runs my ...
4
votes
1answer
410 views

SQL Server 2008 upgrade advisor tool

We upgraded to SQL Server 2008 from SQL Server 2000. But due to some legacy scripts/queries in our health care application, that run only in 2000, we had to run 2008 version on backwards compatibility ...
1
vote
1answer
4k views

Create a linked server with SQL Server 2012 x64

How can I create a linked server to a folder having fox pro dbf files? I can access the dbfs inside Visual Studio 2010, creating a connection with this properties Connection string ...
3
votes
1answer
5k views

Restore Backup Fails - File 'Db' cannot be restored to '{…}.mdf'. Use WITH MOVE to identify a valid location for the file

I am getting the following errors trying to do a restore using the restore command on a backup file I recieved from a customer. RESTORE DATABASE SFDB FROM DISK = N'C:\Backup\Backup.bak' Any ...
0
votes
2answers
314 views

SQL Server 2005 replication for a data warehouse

We are trying to implement some kind of Data Warehouse at my current employer. Most of our data is in a SQL Server 2005, but we might also integrate some Access databases and some databases in a SQL ...

15 30 50 per page