2
votes
1answer
1k views

Find which numbers in [1, 161] are not in the result set?

How to find which two number in [1, 161] is not in the result set? Can I find this two numbers using sql command? mysql> select blog_id from wp_blogs; ... | 149 | | 150 | | 151 | | ...
3
votes
2answers
4k views

Select permission inside stored procedure?

I have granted a user execute permission for a stored procedure through SSMS, but when he tries to execute it, he gets the error: The SELECT permission was denied on the object '[table name]', ...
0
votes
1answer
3k views

Print table documentation with comments?

I have a MySQL database, and I have used MySQL Workbench to insert text into the "comment" fields of many of the columns and tables; the plan was to have the documentation stored in the database. ...
1
vote
2answers
289 views

What are the pros and cons of this schema for flashcards app?

I am planning a flashcards app with the following schema: user(id, name, email) flashcard_group(id, user_id, group_name, group_tag) flashcard(id, group_id, question, solution) guess(id, user_id, ...
2
votes
1answer
285 views

How do I switch master with slave and vice versa on MySQL?

I have two instances of MySQL, one master and one slave. How can I switch them to make the slave the master and vice-versa while avoiding downtime?
1
vote
1answer
765 views

SSIS data transfers between two remote servers

Let's say I have three servers, ServerA, ServerB, and ServerC. ServerA has the production database, ServerB has the staging database, and ServerC has the data warehouse. I've created an SSIS package ...
4
votes
1answer
96 views

How to tell when DBO was changed (and if possible, by whom)

I am looking for a way to track when the DBO account is changed. For example, if someone uses sp_changedbowner is there a way, after the fact, to determine when this occurred, and even better, what ...
2
votes
1answer
4k views

execute() vs executeQuery() in MySQL Connector C++

With MySQL Connector C++, I can use the sql::Statement::execute() function if I am going to modify the database (INSERT, UPDATE, DELETE, MERGE), or the sql::Statement::executeQuery() function if I am ...
1
vote
1answer
142 views

Is MySQL replication suitable for a Write Mostly application?

I'm considering adding another server to my one-server setup application with 600GB MySQL DB. The db and the apache are both running from the same server. In order to avoid backup downtime and improve ...
4
votes
1answer
700 views

MySQL database normalization 3NF

I have homework where I need to create simple web interface and a DB normalized to 3NF. I've chosen ISP client selfcare as my database purpose. Web interface is no problem, the normalized DB is. After ...
2
votes
1answer
1k views

Oracle With Statement and Delete Together

I am trying to use WITH statement and DELETE together. But I get ORA-00928 error. Basically my code is like following WITH TO_DELETE AS ( SELECT TableKey FROM SOME_TABLE WHERE SomeConditions LIKE ...
16
votes
2answers
19k views

MySQL: Create index If not exists

Is there a way to create an index in MySQL if it does not exist? MySQL does not support the obvious format: CREATE INDEX IF NOT EXISTS index_name ON table(column) ERROR 1064 (42000): You have an ...
2
votes
2answers
645 views

mysql myisamchk vs mysqlcheck

We have a mysql database running version 5.0. Every month we shutdown the database for maintenance. We run a myisamchk on the tables to fix data fragmentation, and this takes down the system for up to ...
2
votes
1answer
145 views

MySQL full text search result problem

I have this query that does not return any results: SELECT MATCH (e.firstname, e.lastname, e.tc_identity) AGAINST ('Baha') AS Score , e.* FROM employees AS e WHERE MATCH (e.firstname, ...
3
votes
1answer
4k views

DBCC CHECKDB REPAIR_ALLOW_DATA_LOSS

I had to run dbcc checkdb repair_allow_data_loss with all_errormsgs and it's been runing over 27 hours. DB size is over 15gb and the server (windows 2008) has 32gb memory. I did run this on SQL 2005 ...
0
votes
1answer
763 views

timeout on updating nvarchar(max) after converting datatype

I recently Upgraded to 2008 Enterprise and took the opportunity to change the biggest table in my db with the maintenance window. ran the following to change my ntext field ALTER TABLE ...
2
votes
1answer
1k views

Oracle 10gR2 to 11gR2 upgrade - performance hit [closed]

We've recently upgraded from Oracle 10gR2 (10.2.0.4 ) to 11gR2 (11.2.0.3) and we are noticing a significant hit in performance although execution plans are the same for the offended queries before and ...
2
votes
1answer
791 views

Why is SQLite adding unused disk space to “free-list” after deleting a lot of data in a database?

The SQLite FAQ states the following: (12) I deleted a lot of data but the database file did not get any smaller. Is this a bug? No. When you delete information from an SQLite database, the ...
3
votes
2answers
2k views

How to conditionally stop a psql script (based on a variable value)?

Let's consider the following example (from the start of a psql script): \c :db_to_run_on TRUNCATE the_most_important_table; -- tried to avoid similarities to anything that exists out there Now if ...
0
votes
1answer
1k views

Create second instance of mysqld on windows xp

I am trying to install the new version of the mysql on the windows7 and windows xp . In few of the computers already a new version of mysql are installed. Here I just want to create a second instance ...
-1
votes
1answer
2k views

My master to slave replication stopped and is showing this error when I use SHOW SLAVE STATUS;

My master to slave replication stopped and is showing this error when I use SHOW SLAVE STATUS; | Waiting for master to send event | 172.16.10.37 | repl | 3306 | 60 | mysql-bin.000256 | ...
2
votes
0answers
153 views

How do I back up and restore a SQL Azure database?

How do I back up and restore a SQL Azure database? For that matter, how do I back up and restore an entire Azure account? Let's suppose I am working at a company and I buy a 3 month trial account ...
2
votes
3answers
1k views

Restoring an entire SQL Server database instance

I have a server that we will be completely reformatting then rebuilding. Everything will be rebuilt exactly as it is now - same filenames, same directories, etc. After SQL Server is installed, I ...
6
votes
2answers
177 views

Most effective way to determine the minimum set of permissions for user

I have a database that an application connects to using db_owner permissions. How do I effectively determine the minimum set of requirements actually needed by this user (application) to run without ...
4
votes
2answers
2k views

SQL Server Linked Server to Progress is slow with an openquery view

We have a SQL Server database setup with a Linked Server setup connecting to a Progress OpenEdge database. We created a SQL Server view (for using with SSRS) of some of the OpenEdge tables using code ...
2
votes
1answer
130 views

Unique foreign key constraint between three tables

I'd like to track appointment attendances. Visitors can have appointments, or they can just turn up. If they have an appointment, and miss it, in which case I'd like to record a reason for the missed ...
29
votes
1answer
2k views

In SQL Server, what is the purpose of grouping stored procedures?

One of the most perplexing issues with which I've had to deal has to do with Stored Procedure groups. Given a stored procedure, usp_DoSomethingAwesome, I can create that proc in another group by ...
0
votes
1answer
67 views

Give privilege to new created databases in MySQL

I have user "U" who I want to give him full access to all the existing databases except "db1". I want him to only have select privilege for that db. What I did is I gave "U" all permissions for each ...
5
votes
1answer
5k views

How do I reduce the database size on AWS RDS MySQL?

I have an RDS MySQL database on Amazon Web Services. I want to reduce the size of the database in the control panel in order to save money. Q: How do I make it smaller? Their site says you have to ...
6
votes
2answers
5k views

Create a copy of db and renaming it so i can attach both db

I have a db lets call it 'mysite_db' on a server and i have created another copy in my own pc which is also 'mysite_db', now i would like to attach the db (from my own pc) to the main sql server which ...
5
votes
1answer
2k views

How are multiple indexes used in a query by MySQL?

Imagine a table where there are separate indexes on columns a and b. The query runs somewhat like this: SELECT col1, col2 FROM `table` WHERE a = 'value_1 AND b = 'value_2'; Now, does this query ...
10
votes
1answer
916 views

MDX Query for RANK regardless of hierarchy

I'm hoping to add a calculation to my SSAS Cube (SSAS 2012) that will show the relative rank of whatever the current member is against all other members in that grouper, without specifying the ...
9
votes
1answer
691 views

Initializing Transactional Replication From Backup

There is an option when setting up a publication for replication to Allow Initialization From Backup. We have been creating replicated databases for several years now and have always initialized from ...
0
votes
1answer
60 views

Move databases on same Mac

I have just updated my MacBook to Mountain Lion. Since then, my MAMP installation does not work properly so I decided to use the build httpd/php stuff. For this, I have additionally installed a new ...
5
votes
1answer
673 views

Permissions to delete large objects

Since PostgreSQL 9.0, each large object has its own access rights that are granted with: GRANT { { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] } ON LARGE OBJECT loid [, ...] TO { [ GROUP ] ...
3
votes
1answer
968 views

InnoDB “corruption”

I use: 5.1.63-0ubuntu0.11.10.1 Apache/2.2.20 (Ubuntu) MySQL client version: 5.1.63 The system is continuously displaying the following error during reading data from a MySQL database: ...
1
vote
1answer
609 views

Creating a User to access multiple databases

Is it possible in SQL server to create a User without a Login that can access multiple databases? I am creating a user setting up a service broker queue and the receiver of the message needs to be ...
6
votes
2answers
952 views

Do I have to pay a license fee for Berkeley DB?

I'm planning to use Berkeley DB in a mobile application. Will I need a license even if the application is distributed freely in the iPhone and Android markets?
3
votes
1answer
267 views

Reducing Errorlog file size

We had a user change a password on an account that was on an automation equipment that pinged the sql server many times a second (for no apparent reason - the pinging). In the end my errorlog ...
4
votes
1answer
376 views

How badly does innodb fragment in the face of somewhat out-of-order insertions?

Let's say there's a composite primary key on (field1, field2) Also, let be X a theoretical set of n numbers Inserts look like this: INSERT INTO table(field1, field2) VALUES([a number picked at ...
-1
votes
1answer
448 views

Is there an Oracle function to check for valid Japanese characters (Non-ASCII)?

Is there an Oracle function that can recognize if a character is readable or not? I would like to search a specific column for garbled characters. I know that this can typically be done with a ...
4
votes
1answer
6k views

How can I view what NLS settings are active for other session?

I've got another session that I suspect isn't running with the 'proper' NLS settings for us in Oracle 11gR2. What can I query to show the NLS settings for a different active session - all of the ...
2
votes
2answers
753 views

How do I save functions to individual files in PostgreSQL?

I maintain a legacy application that uses a PostgreSQL database. The application is heavily dependent on stored procedures (aka functions). I want to save these functions to files named after the ...
6
votes
3answers
19k views

How to view contents of table in mysql-workbench

Hi everyone am fairly new to mysql, I made a java program that stores data in mysql database. I am using this tool called mysql-workbench that can create databases, tables and much more. What I wanted ...
5
votes
1answer
501 views

Should I Link a Fact to Hierarchical Dimension at ALL Levels or only the most granular?

Related question about the same project here. I'm looking at two approaches to model a hierarchical relationship between my fact and dimension tables in a data warehouse for storing IT infrastructure ...
1
vote
2answers
223 views

PostgreSQL replication and large import

I am tasked with making large PostgreSQL imports to master instance, and then replicate it across the nodes as read-only data. Still, the CMS system has to be able to write data and replicate across ...
3
votes
1answer
288 views

For creating sum columns in a table that requires immediate reflection, is it better to have persisted columns or triggers?

Is it better to have persisted columns or triggers if you would like to have auto-updating sum/avg/etc... columns? Like if I have this table: CREATE TABLE [dbo].[tbl_shipping_boxes] ( ...
3
votes
1answer
150 views

mysqlservice command syntax

I'm new to MySQL. I've found myself in the position of having two different versions running on one host. I'm a little unsure of how these are working together. Do I issue >service ...
4
votes
3answers
3k views

AWS RDS MYSQL How do I reduce the DB size? [duplicate]

Possible Duplicate: How do I reduce the database size on AWS RDS MySQL? I have a mysql DB on Amazon. It is bigger than I need and I don't want to pay so much. Q: How do I make it smaller? ...
2
votes
1answer
243 views

Representation of circular references constraint

We have a database where we store commands and properties for devices that may be controlled via a network. For instance, "Concrete Device" is an instance of some DeviceType, which in turn contains ...

15 30 50 per page