2
votes
3answers
86 views

SQL Update Efficiency and Blocking Concern

Say I have some SQL similar to the below, which is an update with many joins. The number of rows actually being updated may be 1000's or potentially only a few. The actual join takes a long time as ...
0
votes
1answer
1k views

mysql fine tuning: open_tables, opened_tables

I'm a novice to database administration and have been depending on forum suggestions and answers to help resolve my database hang ups and too many connections errors; I've managed to reduce the ...
0
votes
1answer
103 views

Is it possible to drop data from OLAP database (and to keep definitions)?

[SQL Server Analysis Services from MS SQL Server 2008 R2 Standard] Our OLAP DB takes data from OLTP DB. We want to make some changes to its structure and to do this - it would be helpful if we could ...
2
votes
3answers
1k views

Strange MySQL database that I can't select

I am investigating a web site server (CentOS release 6.3) that runs the traditional lamp stack; I am getting the following output my MySQL; mysql> show databases; +--------------------+ | ...
4
votes
2answers
226 views

MySQL | Complex (for me) SQL Statement, how to?

I have a table that contains posts and another table that contains meta options for each post in first table. The meta options table is a key value pare table. Lets say I have the posts tables that ...
0
votes
3answers
348 views

Transaction in SQL Server

Consider a scenario, when 2 Stored Procedure called inside a Stored procedure like follows. Note: All 3 SP’s are implemented with TRANSACTION. CREATE PROC [dbo].[SP3] AS BEGIN BEGIN TRAN EXEC ...
0
votes
1answer
136 views

Any issue in referencing a unique index from a foreign key table?

Is there any concern in referencing a unique index from a foreign key table? Using SQL Server 2008 R2 Please advise thanks
4
votes
3answers
10k views

SQL Server Restore a SINGLE table from a backup [duplicate]

on SQL Server 2005, we do a weekly full backup with nightly incremental backups. I want to know if it is possible to restore a single table from a backup, either to the source database or a ...
2
votes
4answers
4k views

Quick way to validate two tables against each other

We're doing an ETL process. When all is said and done there are a bunch of tables that should be identical. What is the quickest way to verify that those tables (on two different servers) are in ...
0
votes
1answer
217 views

How can I install a provider for linked server?

I have a provider for a linked server called PervasiveOLEDB.11.0 installed on a sql server 2005 machine. It always me to have a connection to a pervasive sql database. I would like to use this same ...
1
vote
1answer
457 views

Slow queries to remote PostgreSQL db

I am running a Drupal site that is backed by Postgres. This is my first time running something with Postgres; I come from the MySQL world. For doing dev work on the site, I connect to a VPN and ...
0
votes
1answer
811 views

How to return different statements in where clause ? (oracle)

I mean: CREATE OR REPLACE FUNCTION FUNCTION1(ID IN NUMBER) RETURN NUMBER BEGIN SELECT COLUMN1, COLUMN2, COLUMN3 FROM TABLE1 WHERE COLUMN1<= Y AND (CASE WHEN ID < X THEN COLUMN1<COLUMN2 ELSE ...
1
vote
1answer
216 views

Efficient query plan for selecting all data duplicated on several columns

The flavour in question is PostgreSQL, but it is a generic enough query pattern that your techniques for optimising against other RDBMs should help as well. The purpose of the query is to show all ...
4
votes
1answer
135 views

In SQL Server, what are the typical symptoms of parameter sniffing?

There is a wealth of information on the DBA.SE about what parameter sniffing is and how it relates to individual query performance circumstances. I was hoping that someone could provide some sort of ...
1
vote
1answer
128 views

Import indexes with SQL Server

If I have two tables that have identical constraints, datatypes and primary keys is there a way to 'import' the index from one table to another if they're on the same server, but in separate ...
0
votes
1answer
70 views

Where can I read about views for MySQL?

I really don't know nothing about SQL.. I know how to insert and select data from database using PHP but besides that, nothing. I found this view And I am sure that 5 minutes for you to answer this ...
0
votes
1answer
565 views

Postgres 9.1 statistics in pg_stat_database

I've been searching for some information about Postgres 9.1 stats which are stored in pg_stat_database - on the web and on IRC. I found SOME information for 9.2 but even that doesn't seem to be ...
1
vote
1answer
409 views

How can I change SQL Agent Log file to use unicode format?

I've created a database with tables that heavily leverages nvarchar for most of the columns. One of the challenges I'm running into is that when I go to view the SQL Server Agent Log files, I get the ...
8
votes
5answers
579 views

SQL Server 2008 and extended properties

In SQL Server, what do you guys use extended properties for? Some articles and blogs are suggesting they be used for self-documentation of the database and its objects but I can't see this being used ...
4
votes
2answers
212 views

SSDT 2010 and SQL70590 errors

I have Visual Studio 2010 SP1 with SSDT (with Dec 2012 update). I have created a new SQL Server project and imported objects from a database on a SQL Server 2008 R2 instance. The database has a ...
3
votes
1answer
116 views

Aggregating statistics from child rows

I have a parent row and then many child rows, and I must aggregate statistics from these child rows. For a more concrete example let's imagine I have one round of golf (parent row) and then child ...
2
votes
1answer
65 views

Can one assign a performance score to a stored proc to compare performance of 2 procs

I have an existing stored procedure, and an updated version of that same stored procedure where changes have been made, but the same resultset is returned. The updated version of the procedure ...
4
votes
2answers
2k views

identify blocking and send alert

I need to create an alert that will notify me when any query has been blocked for more than 60 seconds. For example if someone has a transaction open on a table and forgets to run a commit or a ...
0
votes
2answers
405 views

Import batches of rows from Excel in parallel

We receive an Excel file weekly currently containing about 250k rows. The file grows by about 300 rows each week. In SSIS I've hooked up an Excel source to an OLE DB destination to import the file ...
1
vote
1answer
1k views

declare keyword error mysql

This is the code I've written: delimiter // create procedure `update_pts`() begin set @ctr=1; set @cnt=(select count(*) from participant); declare cs1 cursor for select sap from participant; open ...
2
votes
1answer
255 views

Optimize simple query in SQL Server

This should be a quite easy query, but I honestly think its execution time can be improved. select idTag,MAX(pctimestamp) AS PCTIMESTAMP,getdate() AS NOW, datediff(SECOND,MAX(pctimestamp),getdate()) ...
2
votes
0answers
270 views

SQL71561 Error on Schema compare after initial import from database

I have created a new sql server project with SSDT 2012, then I went to import an existing database and it created all my scripts. After that I did a schema compare between the project and the database ...
3
votes
1answer
190 views

How to replicate from SQL Server 2000 to SQL Server 2008 R2?

I have SQL Server 2000 as publisher and SQL Server 20008 R2 as subscriber. I want to replicate data from SQL Server 2000 to SQL Server 2008 R2 on a different machine. Primary key fields are not ...
1
vote
2answers
569 views

What am I doing wrong with the Database Tuning Advisor?

My background: I'm a dev/architect, not a DBA. Sorry! So we have a ~400 table 75GB database. I ran Profiler for ~24 hours ("Tuning" template minus LoginName) and have ~7GB of usage recorded in a ...
0
votes
1answer
2k views

how to return table on sql function

I am very new to sql create function i wanted to check data column value at table the purpose is to return full table where data is null , <0 , >1 the problem is i am trying make data is ...
-1
votes
4answers
206 views

Importing data with a lot of SELECTS during transaction

I'm using SQL server 2008 R2 and I have a products table with an auto increment integer id column as primary key and a product_no column (unique) and 6 tables like articles and product_assets which ...
1
vote
0answers
42 views

Is there a canonical list of MySQL defaults which should be changed

I'm setting up a new mysql server as we're building a new app at work. Most of the developers/operations guys are familiar with mysql. Many of mysql's settings (eg strict mode) are set badly by ...
4
votes
1answer
10k views

temporary table inside procedure oracle

I'm in a situation right now. I'm migrating several procedures from Mysql 5.0 to Oracle 11g. Mysql procedures allow me to: 1. Create temporary tables 2. Insert data into temporary tables / Query these ...
2
votes
1answer
493 views

SQL INSERT Query takes 2 seconds and sometimes much longer to execute

I know the question's title is bad, But I have an hard time figure it out my self... sometimes this query runs in 2-3 seconds and sometimes it's takes even 30 seconds I have a table named ...
1
vote
2answers
2k views

I accidentally set password to blank for a PostgreSQL database, how do I change it?

When I set the password to blank, it didn't give any warnings. Now when I try to log in with a blank password, it gives me an error "fe_sendauth: no password supplied". So now I can't log in - any ...
8
votes
1answer
4k views

Handling exceptions in stored procedures called using insert-exec blocks

I have a stored procedure that is called in an insert-exec block: insert into @t exec('test') How can I handle exceptions generated in the stored procedure and still continue processing? The ...
1
vote
1answer
95 views

Updating SQL Server Database

I have a database AfricanRatings on which I used the query INSERT INTO AfricanRatingsAVG SELECT RecipeID, Count(*) AS cnt, AVG(Rating) FROM AfricanRatings GROUP BY RecipeID ORDER ...
4
votes
2answers
187 views

Does SQL Server care about the location of accounts in Active Directory?

Some maintenance is being worked on in our Active Directory here and my supervisor asked me if SQL Server cared about the location of security and service accounts. I told him I didn't think it did ...
0
votes
1answer
468 views

Deploying to an existing database from VS 2010 on TFS

I am trying to find a way in VS2010 to add a few objects to an existing database without scripting out all of the existing objects. This is a maintenance project that is adding a table, altering an ...
1
vote
1answer
83 views

Dealing with large log files

I'm new to the database world and have recently started working with a large database with several tables with mainly varchar text and integers. The two largest tables are of ~50 million and ...
6
votes
1answer
283 views

selecting where two columns are in a set

This might be a silly question, and my suspicion is that I can't do this, but is there a construct in SQL that would allow me to do something like the following: SELECT whatever WHERE col1,col2 IN ...
3
votes
1answer
563 views

Different Results From sys.databases As Different Users

We have a SQL Agent job that is configured to run as user "dbo". This job gets a list of databases defined in sys.databases that match a naming scheme. The job then performs some dynamic SQL to ...
6
votes
1answer
501 views

Getting Identity values to use as FK in an INSTEAD OF trigger

I have a series of updateable views we are exposing to end users as the interface for a back end process. One of these views references two tables and requires an INSTEAD OF trigger for UPDATE and ...
12
votes
1answer
13k views

How to force drop database in SQL Server 2008

I'm trying to force drop a database, but after dropping the database, when I try to recreate the database, I'm getting the error cannot create file C:\Program Files.....[databasename].mdf because ...
1
vote
4answers
3k views

Restore backup fails - not enough disk space [duplicate]

I have a backup that's about 6Gb. It's a "light" backup of the original (with the log tables purged), which is about 14Gb. I try to restore the backup on my SQL Express local server. It fails with a ...
3
votes
2answers
921 views

Update row based on match to previous row

I have the following table: Declare @m_TestTable table ( RowID int, OrderNo nvarchar(10), DetailID int, FirstUniqueDetailEntry int ) Insert into ...
6
votes
3answers
1k views

Clustered index in SQL Server vs index organized tables in Oracle

I am making the transition as a database developer from SQL Server to Oracle and found some fantastic resources here already (How to make a transition from SQL Server DBA to Oracle? and As a DBA, how ...
2
votes
3answers
158 views

Looking for industry standard and/or tool to represent and export RDBMS metadata

Do you know of an industry standard that is designed to describe the metadata contents of a relational database (or part of it, such as tables, columns, etc.)? Do you know if a tool exists that does ...
4
votes
1answer
310 views

Deciding between an IsDeleted/DateDeleted column or a separate History table?

We have a table that stores nothing but an AccountId, TagId, and DateCreated. Users can update the Tags on accounts, which adds or remove records from this table. No tag can exist more than once on an ...
2
votes
1answer
436 views

Does rowlocks on index cause keylocks? : Transaction (Process ID xy) was deadlocked, example included

I am currently experiencing the error (logged via traceID 1222 ): keylock hobtid= 8205698989 objectname=mydb.dbo.Orders indexname = _dta_Index_Orders_5_120345_K1_K2_7_1 id=lock43fe181 mode=S ...

15 30 50 per page