7
votes
1answer
619 views

CATCH block is triggered when it should not

On my neverending quest for shooting myself in the foot with save transaction I seem to have found even more ways to fulfill the quest purpose. The save transaction clause itself this time is out of ...
1
vote
2answers
482 views

How do I run a SQL Server 2005 job on Windows 7?

I have Windows 7 and SQL Server 2005 Version 9.00.1399. I can successfully create an SSIS Package, however I am unable to execute it successfully as a scheduled job. When I run the job, SQL Agent ...
2
votes
1answer
1k views

MySql - alternate of auto_increment on multiple columns

Since auto_increment on multiple columns is supported in MyISAM engine only and I can't use it because of its drawbacks (table lock, slower writes, no-transacts etc), I am looking for an alternative. ...
1
vote
1answer
14k views

“Operand type clash” with DATE column

I enter the following command into the SQL Server Management Studio insert into testtable ([product_name], [price], [expire_date], [expire_time]) values ('Teapot', 10.00, 23/12/2012, '12:35:00') ...
4
votes
4answers
1k views

Shrink database is not shrinking as much as expected on a 1.5 TB database.

I'm working in an Enterprise system with a 1.5 terabyte database that is on a single filegroup, with the log in Simple Recovery Mode. Since we have many teams working on different projects in ...
1
vote
3answers
993 views

Does Log-Shipping need Transaction Log Backup from Primary Server?

In this video tutorial it is explained that we should use the transaction log backup of the primary server database and restore it into the secondary server database for log shipping. I was doing a ...
14
votes
2answers
4k views

PostgreSQL procedural languages - differences between PL/pgSQL and SQL

Can anybody please summarize the differences between: http://www.postgresql.org/docs/9.1/static/xfunc-sql.html and http://www.postgresql.org/docs/9.1/static/plpgsql.html ? Main points: ...
1
vote
1answer
1k views

IBM DB2 - store large files

I want to store large files in a DB2 database and I need more information about which is the best technique to use as I am new in this IBM product (previous experience with T-SQL only). The ...
18
votes
3answers
7k views

Data obfuscation in SQL Server

What is the best practice for Data Obfuscation in SQL Server? We'd like to use masked Production data in our UAT system. If we want to do it quickly, and with a higher level of obsfucation, what ...
7
votes
2answers
26k views

What is the easiest way to move data from Oracle to SQL Server?

One of our products supports both Oracle and SQL Server as database backend. We have a customer who wishes to switch from an Oracle backend to Microsoft SQL Server, which isn't a typical transition ...
4
votes
3answers
7k views

COUNT and SUM at the same time after removing duplicate rows

I'm using PostgreSQL and I can't figure out a query for doing a COUNT and a SUM of two different columns. Basically I'm looking for something like a SUM(hits DISTINCT record_id) The table: status ...
1
vote
1answer
44 views

Linking Tables Together

If I have a table such as this, CREATE TABLE [dbo].[StreetLight]( [Id] [int] IDENTITY(1,1) NOT NULL, [Description] [nvarchar](50) NOT NULL, [Shape] [geometry] NOT NULL, CONSTRAINT ...
3
votes
1answer
140 views

Analysing A Query Plan

Why is the following query slow? select count(*) from [dbo].[mt_dispatch_link] , [dbo].[_mt_dispatch] [_mt_dispatch] where (mt_dispatch_link.contract_id_1 = _mt_dispatch.contract_id ...
3
votes
3answers
2k views

Set Backup Compression on SQL Server 2008R2 on by default

I can't seem to find the option to set the server property that will enable compression on SQL database backup to be ON by default, so I don't have to manually set it every time. Ca anyone point me ...
2
votes
1answer
63 views

What else does sp_addmergefilter do

I am running the following stored procedure to add a merge replication join filter, sp_addmergefilter What else does that stored procedure do behind the scenes? I am calling that stored procedure ...
6
votes
1answer
260 views

How to Optimise Query

I have a database structure similar to this, CREATE TABLE [dbo].[Dispatch]( [DispatchId] [int] NOT NULL, [ContractId] [int] NOT NULL, [DispatchDescription] [nvarchar](50) NOT NULL, ...
3
votes
2answers
350 views

Query for fetching records from SQLite database on Blackberry

I want to fetch data from SQLite database for Blackberry. There is one table with four columns: ID, FROM, TO, TIME I want to fetch record on the basis of FROM, and TO values. Where condition 1: ...
4
votes
1answer
1k views

Modelling Relationships in an E-R Diagram, Table or Foreign Key?

Should a relationship in an E-R diagram be created in the database as a table or a foreign key? For example: a tutor lectures a class I see it as three possibilities: there is a "lectures" ...
3
votes
1answer
2k views

Oracle integer to number conversion

According to the Oracle documentation, creating a table with a column of ANSI type INT, Oracle will convert it to NUMBER(38). According to the same document, NUMBER(38) is supposed to be a NUMBER ...
6
votes
3answers
9k views

Test MySQL credentials from Linux command line?

How do you test MySQL credentials from the command line on a Linux server?
5
votes
2answers
4k views

Should I create a nonclustered index on all searchable columns or just each column separately?

I am not sure as to properly use non-clustered indexes. The SSMS plan estimator said to add another index when the following index was on the table already. CREATE NONCLUSTERED INDEX ...
6
votes
1answer
1k views

Converting Database from GUID to Integer Keys

I have a medium sized database (~100 tables) that uses GUIDs as primary keys in all tables. In one of our most active tables the GUIDs are causing an unnecessary increase in storage requirements. ...
5
votes
2answers
8k views

I cannot get SQL Server 2012 to install the database engine

SQL Server 2012 installation on a standard Windows 2008 R2 server. It refuses to install the database engine or sql replication. During the installation I got no errors saying that it wasn't ...
1
vote
1answer
529 views

TimeZone parameter in postgresql.conf

postgresql documentation says: All timezone-aware dates and times are stored internally in UTC. They are converted to local time in the zone specified by the timezone configuration parameter ...
6
votes
1answer
886 views

Login to SQL Server 2k8 R2 SP1 via Active Directory Group

I added an Active Directory group as a Windows Authentication Login to our SQL Server 2008 R2 database. When a user who is a member of that group tries to connect to the server he is given a login ...
2
votes
2answers
96 views

Regular Expression Difficulty

I'm trying to extract 456 from the string :123:456: as follows: select regexp_substr(':123:456:', ':(\d+):', 1, 2, 'i', 1) from dual However, this query returns null. What am I doing wrong?
1
vote
1answer
321 views

Database comparison tool for IBM db2 like OPatch? [closed]

I am looking for a database comparison tool for IBM DB2. I was wondering if there is a utility for IBM DB2 similar to OPatch in Oracle's db 11g?
14
votes
3answers
3k views

Is there any benefit to defragmenting SQL indexes in a SAN environment?

Our SQL server lives on a SAN. It contains dozens of OLTP databases, some with several tables containing over 1m records. We have been running Ola Hallengren's index maintenance scripts weekly, and ...
3
votes
3answers
880 views

When are Archived Redo Logs generated?

We have an instance in Oracle 10g. Only one schema is used for a web application (Internet-facing), which is only user for reading information, no adding or modifying data. The rest of schemas are ...
3
votes
2answers
2k views

Restarting One Database Not Entire Server

Is there anyway to restart one database in SQL Server instead of restarting the entire server? I have a task in perpetual rollback on one of my databases. I'd like to restart it without turning off ...
10
votes
2answers
2k views

Does Oracle PL/SQL have a standard ASSERT routine?

I'd like to use an ASSERT routine functionally similar to the one found in other languages, i.e. a construct (be it a procedure, syntax...) ASSERT( <condition>, <msg>) such that when ...
6
votes
2answers
30k views

Easy way to check connectivity to SQL Server from client

For troubleshooting purposes, I would like to be able to check if a client can connect to a SQL Server instance, independent of the application that possibly can't connect to the SQL Server. Is there ...
3
votes
2answers
340 views

Error Occured during the login process

I have Sql server 2005 on my local machine. During the studies of SQL server network configuration, I login my sql instance by my M/C IP (server name) and login 'sa' and run the following script. USE ...
2
votes
4answers
1k views

Identify cause of unusual transaction log growth

I have an application running on SQL Server 2008 (its a cluster but it hasn't failed over.) Previously the transaction log used to grow to 10-20Gb every 2-3 days and we would shrink it back after ...
1
vote
1answer
816 views

how to get last date of today in datetime datatype?

select dateadd(s, -1, dateadd(month, datediff(month, 0, getdate())+1,0)) when i execute this query, it gives '2012-01-30 23:59:59.000'. I donno how to get it as '2012-01-30 23:59:59.997'. If anybody ...
6
votes
2answers
470 views

Is it worth partitioning a Table by single value in Oracle?

Normally, if you have a column you frequently query a table by, you ought to stick an index on it. But is it worth also partitioning a table by this column, if all possible values are known in ...
13
votes
2answers
4k views

Is the overhead of frequent query cache invalidation ever worth it?

I'm currently working on a MySQL database where we are seeing a large number of invalidations from the query cache, primarily because of the high number of INSERT, DELETE and UPDATE statements that ...
1
vote
1answer
1k views

How to change the display of an empty string in mysql command line tool?

I'm maintaining a database with InnoDB tables. These tables have some columns of type (from show create table): `val0` varchar(30) default NULL, `val1` varchar(30) default NULL, etc... From the ...
13
votes
4answers
938 views

The order of columns in a table [duplicate]

From what I've seen so far, when we define a table, normally we put the primary key as the first column. If there are miscellaneous columns that are common in all tables, they come at the bottom of ...
2
votes
1answer
383 views

How do I ensure consistent MySQL backups?

How can we ensure MySQL backups are consistent when they are taken as full backups as well as incremental backups using binlogs? According to me, I record the COUNT(*) from random tables after ...
2
votes
1answer
3k views

What does reslen and other means in mongodb log?

database.tablebusiness query: { LongitudeLatitude: { $nearSphere: [ 106.772835, -6.186753 ], $maxDistance: 0.04498373205078301 }, Prominent: { $gte: 15 }, indexContents: { $all: [ /^aru/, /^op/ ] } } ...
2
votes
2answers
962 views

Does pt-table-checksum point out rows that are different between Master and Slave?

Trying to verify replication integrity of my replica. And I found that pt-table-checksum is one of the best ways of doing it. I have a simple Master->Slave set up. Have created a sample table with 10 ...
2
votes
1answer
1k views

foreign key constraints on same table

I have a table structure like this. tblquestion ( nQuestionId1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT NOT_NULL, nQuestionId2 INT UNSIGNED ALLOW NULL ); Here..nQuestionId2 has a foreign key ...
0
votes
1answer
104 views

Is Index Used for This Query

If so, which one? How do we know? I have 3 indexes in a query. Actually only the first 2 should be useful { "v": NumberInt(1), "key": { "LongitudeLatitude": "2d", "Prominent"▼: ...
2
votes
3answers
8k views

Date format in SSRS

I'm wondering if there is a setting in SSRS to indicate the date format. We need to show the dates in dd/mm/yyyy format on the reports and from what I can see in database the value has been stored ...
1
vote
1answer
1k views

How to interpret this “db.explain()” for this mongodb query

db.tablebusiness.find({ "LongitudeLatitude" : { "$within" : { "$centerSphere" : [[106.772835, -6.186753], 0.0089967464101566] } }, "indexContents" : { "$all" : ["warung"] }, "Prominent" : { "$gte" : ...
1
vote
1answer
238 views

What happens to existing MySQL databases when I upgrade my Ubuntu distro?

I am in the midst of upgrading my Ubuntu distro from 10.4 to 12.4. Fearfully, it asked me for root password on MySQL when I was upgrading the distro. I used to have databases on that server, would ...
1
vote
4answers
725 views

How do I develop this data model without a circular reference?

I am trying to develop a concept for a new call tracking system for a help desk. The top 3 levels reference each other. I am trying to determine a better way to link these tables, and am drawing a ...
5
votes
3answers
2k views

Total of orders open on a given date for each date in a date range

This question is similar to Running total with count?, but please allow me to explain some further twists on the issue. I'm using SQL Server 2008, so the cursor option described by Aaron Bertrand ...
2
votes
4answers
10k views

What GUI tools can be used for PostgreSQL in Mac OS X? [closed]

I have recently started using PostgreSQL with my rails app. I was looking for a SQL GUI to the PostgreSQL database (for Mac). Anything better than pgadmin3?

15 30 50 per page