An acronym for "Structured Query Language" (it's not the name of a specific DBMS product), SQL can be used in relational database management systems (RDBMS) to query, update, delete, and insert data as well as modify the structure of the database. It can also be used to manage schemas and data ...

learn more… | top users | synonyms (1)

2
votes
1answer
64 views

SQL Profiler - Insert values?

I setup an SQL profiler to run, but I am not seeing any values for updates/inserts. Is there a way to see them? All I see is stuff like this: insert into some_tbl(id, col1, col2, col3) values ( @P0 ...
1
vote
1answer
79 views

Optimizing Postgres query

I've got a one to one relation from users to addresses table. Where one user can have one search address and one verified address. I've got two indexes on addresses table : Index on state field ...
2
votes
1answer
33 views

Understanding postgres reason for picking this query plan

I ran a query: select * from orderline where orderid = 12345 and status > 0 that gave me the following plan: Bitmap Heap Scan on orderline (cost=286370.00..531410.78 rows=76372 width=155) ...
1
vote
1answer
37 views

Create database before restore multiple files

I've several database, most of them have multiple files (both data and logs) and multiple diff and trn backups. I've already a restore script (scheduled and working on other server) that takes all the ...
1
vote
0answers
49 views

SQL command in stored procedure continue on error

To perform Checkdb on all database of server i am using a stored procedure which loops over a view which contains list of databases in server and the stored procedure performs checkdb on all databases ...
0
votes
1answer
146 views

How index work in oracle? [duplicate]

I want to understand : How index work in oracle. How they are stored in the disk. How they increase the efficiency of a query? By third point I means how Index contribute to the efficiency of ...
1
vote
0answers
24 views

WMI event alerts

I am trying to understand WMI event alerts and have implemented a mirror with alerts on DATABASE_MIRRORING_STATE_CHANGE such that all database failover if the state is either 7 or 8 (manual failover ...
0
votes
2answers
50 views

Separating a date column in Access into Month, Day and Year while keeping the new columns ordered by a seperate column(primary key)

I have a column titled DateOpen which lists the date files were opened in d/m/yyyy format. I want to split the entries in that column into new columns titled MonthOpen, DayOpen and YearOpen while ...
1
vote
2answers
97 views

How can I dynamically alias columns?

I have a table (not designed by me) which has 20 variably named columns. That is, depending on what type of record you are looking at, the applicable name of the column can change. The possible ...
0
votes
2answers
50 views

How to store a database table in multiple disks with assigned ratio?

I am going to deploy database tables to multiple disks. My database layout would be like following example: There are 3 tables (Customer, Order, Product) and 4 disks (disk_A, B, C, D). Customer: 5% ...
1
vote
1answer
47 views

Error while importing sql - Specified key was too long; max key length is 1000 bytes

I am trying to import an sql file which shows me the following error: Error SQL query: -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE ...
0
votes
0answers
16 views

WHY Extended Distributed Transactions (XA) NEEDED

I want to know what is Extended Distributed xa Transactions. why it is needed. if we enable this for another database on any existing sql server will it impact my existing databases.
0
votes
1answer
31 views

Full Transaction Log on closed source system

I have a closed source application which has the transaction log filling up on a daily basis to 60+gigs. I have ran a trace on the database and no inserts and updates are occurring. The following ...
0
votes
1answer
45 views

Where can I get best resources to learn sql? [duplicate]

I am very new to the databases just have basic knowledge about it. I want to learn sql language and dont know where to start. Please help me to start with it. And what is the difference between ...
2
votes
1answer
45 views

redundant foreign keys in PostgreSQL - are there any indexing benefits?

Note: this is not the same as this SO question which is about adding redundant information in the tables themselves. Does the final statement in the below series of statements buy me anything in ...
0
votes
2answers
127 views

What is the performance difference between IN (42) and id = 42 in MySQL?

Are there any performance differences between SELECT * FROM table WHERE id IN (42); and SELECT * FROM table WHERE id = 42; ? The question is about just supplying a single value. The ...
0
votes
0answers
39 views

Master Slave Databases and their architecture

We are currently using Sql Server 2005. We currently have separate databases for different instances of our application. The application is a heavy in terms of data and processing. We now want to ...
0
votes
1answer
103 views

ORA-30009: Not enough memory for CONNECT BY operation

I have a Linux VM (with CentOS 64 bit) where I installed Oracle Database 11g Express Edition. The database is running, I can use sqlplus and I can create tables and stuff. However, when I run a ...
2
votes
1answer
427 views

Converting XML to SQL tables

I have a large XML file in the following format and I need to convert this file into a MySQL table. Please let me know how can I accomplish this? ~~~~~~~~~~ <host starttime="1392325468" ...
20
votes
2answers
863 views

Why does query error with empty result set in SQL Server 2012?

When running the following queries in MS SQL Server 2012 the second query fails but not the first. Also, when run without the where clauses both queries will fail. I am at a loss why either would fail ...
0
votes
0answers
9 views

Do link servers cache remote database connections?

I have set up a link server from a database server (SQL2008) to my local SQLEXPRESS db, using the actual database as its Failover Partner. I then stopped the SQLEXPRESS service and I could still ...
2
votes
1answer
74 views

How to allow connections to SQL Server with 2 differents ip

I have a small issue here: I have a SQL Server instance 2012 (let's call it INSTANCE) on a cluster. I also have 2 network interfaces for this instance: SQLINSTANCE.my.metwork ...
-1
votes
2answers
107 views

How to Create users in sql server for accessing only one database using Management Studio [closed]

How to Create users in sql server 2008 R2 for accessing only one database using Management Studio. regards, salman
0
votes
3answers
119 views

How to IFNULL or COALESCE rewrite in a SQL query?

I there a way to rewrite a SQL query, so I can avoid IFNULL or COALESCE, because the HXTT DBF JDBC driver (supports SQL92) throws the following error.: Caused by: java.sql.SQLException: The aggregate ...
1
vote
1answer
48 views

Oracle - Date of Selection on table

how to get last date when someone perform selection on table? Last accessed in terms of select statement only not last updated date
0
votes
2answers
42 views

Do I need to have enterprise server in order to have multiple data sources in SSRS

I am currently running a single server setup of SSRS on MSSQL Server 2008 R2 Standard Edition and would like to know if I can have multiple data sources in this type of setup. The reason I ask this ...
0
votes
1answer
62 views

DB2 - Not enough storage in the database heap error when trying to create database

So like the title says I'm trying to create a database using this script db2 -v -t "CREATE DATABASE %DBNAME% ON '%DBDRIVE%' USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM CATALOG TABLESPACE ...
0
votes
2answers
44 views

mysql select query to select from single table with multiple WHERE clauses

i am new to database querying so apologies for this rudimentary query question. thank you in advance. table called "neuron" columns in "neuron" called "neuron_id", "neuron_name" + others (not ...
0
votes
1answer
69 views

Nested query not recognize external table

i need to a query that show week by week the total amount of imports of any company and in addition add a ranking position depending on that amount. I've made this query but the problem is the inner ...
1
vote
0answers
114 views

Postgres database zero down time production deployment

I need some idea about how I can deploy a financial application in production environment using PostgreSQL DB with zero down time. I have two servers in Master-Slave design. Currently I am giving ...
0
votes
2answers
104 views

Join two subquery in hql

How can I write this sql query in as hql: select count(distinct s.id) as prepaid, count(distinct ss.id) as postpaid from (select * from subscriber where subscriber.ispostpaid=0) s join (select * ...
1
vote
4answers
86 views

Backup from Server1 and restore it to Server2?

IF we have two Servers installed with SQL Server 2008 instances, Server1 has three drives C, D and E with 100, 500 and 500 GB respectively and Server2 has three drives C, D and E with 100, 300 and ...
1
vote
0answers
37 views

Find repeating tickets with more than one criteria

Lets say I have 2 tables: atms & tickets each atm has many tickets. ATM table: ID | NAME ------------------------- A0109 | ATM 1 A0227 | ATM 2 etc. | etc. Ticket table: ID | ATM | ...
0
votes
2answers
167 views

Finding all sql id, sql text, number of executions,execution time between two AWR snap ids in oracle

AWR report provide the SQL information for top 10-20 SQLs, is it possible to get information on SQLs that do not make it to the top list. How do we find all sql id, sql text, number of ...
0
votes
0answers
51 views

Based on these DBCC SHOWCONTIG stats, should I index this table?

I have a SQL 2008 Standard server on full mirror (safety). I reorganize all indexes weekly. I am looking into rebuilding a few indexes to improve performance. I ran DBCC SHOWCONTIG on my largest, most ...
0
votes
1answer
92 views

SQL Query: Join Tables using two partial string matches

Using MS Access, I have to combine two tables where two criteria must be met: Container = Container AND Booking = Booking. I have two tables where fields are missing a value: Table1 and Table2 have ...
0
votes
1answer
85 views

Subtract values from SELECT in SQL

I have the following 2 queries.: shipManagementInvoiceNetValue: SELECT IFNULL (SUM (shipManagementInvoice.netto ), 0) AS shipManagementInvoiceNetValue FROM tckopf AS shipManagementInvoice WHERE ...
0
votes
1answer
110 views

create a batch script on windows that periodically starts a sql function

I need to create a batch script on windows that periodically starts a sql function written in 'plpgsql'. I can use windows schedule task for creating a cron job but I don't know how to write the ...
1
vote
1answer
63 views

Return value formatted similar to if casted as money

My client's system is very outdated, and there is nothing I can do about it. What I'm trying to achieve is to extract values always with at least 2 decimal places. E.g. From 1826.5695600000 ...
0
votes
1answer
63 views

Issues restoring db [closed]

So I had initially received the 'database in use' error, searched for a solution on Google, was led to believe that I might need to change the default db account connects to, changed it and am still ...
1
vote
1answer
34 views

Case when missing line logic

I have a case when statement in a extract query which doesn't seem to be returning what i'm expecting DECLARE @Val1 int, @Val2 int,@Val3 int, @Val4 int, @Val5 int SELECT @Val1 = 5 , @Val2= 2,@Val3= ...
0
votes
0answers
25 views

Mysql View Performance on Aggregate Functions

I've a table that contains weekly statistical infos. ex. Society - Week - Year - Data AAA Inc - 1 - 2014 - 10250 AAA Inc - 2 - 2014 - 5235 BBB Inc - 2 - 2014 - 3210 ... Over this table i need to ...
-1
votes
1answer
127 views

How to set up a connection in Pentaho Kettle for Oracle using a SERVICE NAME instead of SID?

This error shows up when I try to connect to database string host:port/servicename.
0
votes
2answers
187 views

exporting oracle tables on command line as sql files

I use exp and expdp to export database tables on command line but it generates binary .dmp files. I want to export/import tables as .sql* files on command line like pl/sql developer app can do. Is ...
6
votes
2answers
172 views

Should I nest dependent outer joins in SQL Server?

I have heard mixed information on this and am hoping for a canonical or expert opinion. If I have multiple LEFT OUTER JOINs , each dependent on the last, is it better to nest them? For a contrived ...
1
vote
1answer
45 views

CDC not picking up changes [closed]

CDC has been set up for one of our databases in our test environment but it's not capturing any of the changes. I've made sure the capture job is running. I've disabled CDCs for the database, enabled ...
2
votes
1answer
57 views

Result of a query in SQL

Let us say that we have to write a query for: Find the distinct names of all students with percent>90 in courseno=107 given three relations: Students (rolno:integer,sname:string) Courses ...
1
vote
1answer
47 views

Designing database with Category and Tags for Posts - Seeking for guidance/advice

I'm not really a database novice but I'm not an expert either. Problem: I'm having this difficulty on designing my Post, Category and Tags relationship. I've read Normalization many times but could ...
0
votes
1answer
25 views

Postgres recovery.conf options

I am setting up Postgres binary replication. In my slave's recovery.conf, I am suggested to have 2 options. I am wondering if the directory specified in restore_command and archive_cleanup_commands ...
0
votes
2answers
53 views

Disk write in iotop when doing mysql “Copy to tmp table”

I have just moved servers from a two-server configuration with the application and database server running separately to a one-server LAMP stack. Unfortunately the issue that I have encountered on ...