An acronym for "Structured Query Language", 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 access privileges.
0
votes
2answers
58 views
Multiple Aliases in an SQL Query
Would it be possible to give a table in MySQL query multiple aliases?
If so how would I do this?
-1
votes
2answers
73 views
Combine two SQL statements to a single statement [closed]
My question is related to SQL. I need to pull values from two different tables. I am not successful in doing that. I am able to join the two tables with only a single condition but not many values ...
2
votes
0answers
48 views
merge replication too big
I have multiple handhelds which sync their data via merge replication. from time to time, new core data is imported on the server-database.
for some reasons I keep the old data in the databse and set ...
2
votes
0answers
143 views
Sybase SQL - Truncation error occurred. Command has been aborted
Need help with below code, as it fails with truncation error
Truncation error occurred.
Command has been aborted.
create table monCacheQuality (
ServerName sysname
...
3
votes
1answer
69 views
Convert SQL Server UPDATE Statement for Use in Oracle
I can not get this UPDATE statement to work in an Oracle environment. It was written for SQL server.
I am looking for some guidance on how to convert it.
UPDATE
SOB
SET
COA = CASE
...
0
votes
2answers
71 views
Exploring and optimizing SQL performance of your system (PostgreSQL and Hibernate)?
Imagine you have inherited some project with extensive usage of SQL queries.
Let us assume that Hibernate is used as ORM and PostgreSQL as database, but thats not the point.
A question is: could ...
3
votes
2answers
71 views
Find all the SP's where a particular column is not updated
I want to find stored procedures where a particular column is not updated.
As an example
SP1:
BEGIN
UPDATE YourTable
SET Foo = @Foo,
Bar = @Bar
WHERE Id = @Id
...
0
votes
0answers
23 views
Ghost replication jobs in replication monitor
Has anyone ever seen and know the cause of this issue? We have transactional replication with pull subscriptions. At 2am this morning it appeared that the job (that runs every 15 minutes) stalled out. ...
2
votes
2answers
200 views
SSIS Data Flow Task Excel to SQL table NULL value will not work for small INT datatype
I have a package that imports excel data into a SQL table. One of the columns in the table is of "smallint" data type and it allows for nulls. The excel file column that has the data that is suppose ...
0
votes
1answer
24 views
Comparing two tables for a UUID change and fix it
I have two tables which I'm trying to reconcile the differences of in postgresql.
Table A is old and needs updating.
Table B is an updated, schema identical version of Table A which I have the data ...
-1
votes
2answers
102 views
Select query having count and variable
I have a table like the one below.
I need to form a select query. I'm going to pass a RefID like
SELECT SNo FROM Register WHERE RefID = 1
And beside the SNo in the Statement, I need to have ...
13
votes
6answers
528 views
Why should an application not use the sa account
My first question ever, please be gentle. I understand that the sa account enables complete control over a SQL Server and all the databases, users, permissions etc.
I have an absolute belief that ...
1
vote
2answers
32 views
SQL Server database backup on Remote site
We have 4 different sites and each site has a SQL Server.
our requirement is to have a SQL Server backup or database(Mdf files) of site 1,2,3 in site 4.
In case of disaster on any of the site we ...
0
votes
0answers
39 views
Prices for database administration tools [closed]
What should be the optimum price of an SQL database administration tool with 16 features including backup status review, server and data configurations, server statistics, disk space review, ...
0
votes
0answers
16 views
Data usage increases initially when reorganize partition mysql cluster
In my MySQL cluster, the data usage of 4 data nodes is approximately 77%. I added a new data node online, and attempted to reorganize partition to redistribute data among all data nodes.
But before ...
0
votes
1answer
40 views
Set field values to newly imported rows in PostgreSQL table with existing data
I have a PostgreSQL table with existing data, and needs to import all the rows in a CSV file into that table. I am using pgadmin3's Import tool to do the import.
Question: For the newly imported ...
5
votes
1answer
109 views
Unexpected Table Scan with Parameterized LIKE
I'm experiencing an unexpected table scan on SQL Server 2005 against a heap table when parameterizing a LIKE statement... but when the same value as the variable is hard-coded, the expected Index Seek ...
1
vote
2answers
62 views
Handling expiration in a course registration or ticketing system
I want to restructure the database for a web application I inherited for handling summer camp registrations, but my question is relevant to any event registration or ticketing system.
My question is ...
0
votes
0answers
27 views
mysql: how many disk seeks were made for a select query
I will fire a select query. I want to know how many disk seeks does that query take.
mysql documentation has given formula for full table scan. ...
1
vote
1answer
55 views
Find out number of active locks on a table
I was wondering if there is a way to find out the number of active locks held on a table in SQL Server?
2
votes
1answer
136 views
Bitmask Flags with Lookup Tables Clarification
I've received a dataset from an outside source which contains several bitmask fields as varchars. They come in length as low as 3 and as long as 21 values long. I need to be able to run SELECT queries ...
2
votes
1answer
100 views
sql server partitioned view execution plan questions
I have created a partitioned view for 3 tables tb_sales2010,tb_sales2011,tb_sales2012 using check constraint
(respectivly for each table)
datepart(year,[Date])=(2010)
datepart(year,[Date])=(2011)
...
0
votes
2answers
102 views
Estimated Execution Plan SQL Server Sort?
I'm running a query and its taking a age to execute, looking at the execution plan I can see that 51% of the cost is in the SORT? when in the actual query i am not ORDERING BY anything.
Anyone got ...
1
vote
1answer
15 views
Big jump in search time for Postgres Index query for results with high selectivity
I am doing some performance comparison of databases and lucene for full-text searching.
So I use Postgres to create an Index for the data to search:
CREATE INDEX bodies_index
ON bodies
USING gin
...
2
votes
1answer
76 views
Limiting number of results in a Partition using OVER(PARTITION BY)
In the following query, why is it that we have to limit the results returned from each Partition by using the clause WHERE foo.row_num < 3 outside of the subquery foo but not from within the ...
1
vote
1answer
42 views
Retrieving Alternating Values
I have a column with two values in my database, I want to retrieve the two values alternately, for example I have:
name itemcode
----------
A 1
B 2
C 2
D 2
E 1
F ...
5
votes
2answers
252 views
Recreate Indexes on 1 billion record table
I have a table with over 1 billion records and it has 6 indexes (including Clustered index (ID)). I need to partition this table on a new Clustered index with date column. I have just enough space ...
3
votes
1answer
100 views
Azure SQL Administrator Can't Access Master Database
I created an SQL server and database. I can log in to the database manage page with my administrator account, and manage the database I created, but when I try to look at the master database, it says:
...
0
votes
2answers
106 views
SQL Server Change Tracking
I work for a company of about 80 employees and they all seem to need access to our database on a regular basis. I don't have time to write applications to meet all of their needs so I'm just going to ...
0
votes
1answer
81 views
How to use array variable in query in PostgreSQL
Create table t1 ( xcheck varchar[], name text );
CREATE OR REPLACE FUNCTION fn_acgroup(xch varchar[])
RETURNS record AS
DECLARE xrc as record;
execute 'select name from t1 where xcheck @> ...
3
votes
1answer
130 views
Automatic database file creation based on database file size in SQL Server 2008 R2
Now i am using SQL Server 2008 R2 database for data logging. The name of the database profile is MASTERDB. That profile has one data file called MASTERDB.mdf and one log file called MASTERDB_log.ldf. ...
0
votes
1answer
48 views
Extracting Multiple Values from Single Field
I'm an SQL beginner and I'm having trouble searching correctly for the answer to this question, although I'm sure that it's been asked before. I have an column in an SQL table that looks like this:
...
0
votes
2answers
74 views
Missing data after attaching .mdf file
Recently, one of my customers had a server crash. Unfortunately, the 3th party who was responsible for the backup was 'forgotten' to schedule a backup of the DB (I know, I should have notice that).
...
0
votes
1answer
72 views
Advise On SQL Server Data Replication
We have a huge enterprise system, with geographically seperated SQL servers.
We have some requirements related with data replication between these servers.
We have considered the Sync Framework ...
2
votes
2answers
150 views
How does ORDER BY really work? [duplicate]
I have one question that confusing me.
By logical query processing, the SELECT clause comes before the ORDER BY clause, and in theory, every step in a query creates a virtual table. So, how is it ...
2
votes
1answer
36 views
What is the algorithmic complexity of a PosgtreSQL greater than or lesser than index query (compared to equality)?
Assuming there is an index idx_int on an int_col column, what is the algorithmic complexity of a query like this?
SELECT id FROM table
WHERE table.int_col > 1;
I'm specifically interested in ...
3
votes
1answer
256 views
Oracle insert through dblink performance issue
I'm trying to do an insert as select to a table via dblink. The query looks like this:
Insert into MARS_SUPERVISORS_PUB@EDHPUB
select
{...}
from edhper a, edhper b
where ...
0
votes
1answer
61 views
ORA-01435: user does not exist
I am trying to run the SQL queries coded on my friend's laptop onto mine. I have imported the .sql file into SQL developer and I'm trying to run it.However, I keep getting the error:
01435. 00000 - ...
0
votes
2answers
155 views
optimize big sql query
My query has to return a statistics for example for march containing productname and price and its sidedishes (1:n relation) with the right price of each sidedish and the right tax for each sidedish ...
2
votes
1answer
81 views
How to make postgresql SUM to be more accurate on large amount of floating point data?
I'm trying to SUM 8 million floating point (REAL) values with simple query like this:
SELECT SUM(metric) FROM metrics;
However, it returns very inaccurate result.
It should return 137,586.77, but ...
2
votes
2answers
99 views
How can I improve my table design for different types of an entity?
Consider an accounting system as an example. I have an Entity called Client. Client can be of different types, with different fields applicable to different types. I consider creating separate tables ...
3
votes
2answers
114 views
Identifying which values do NOT match a table row
I would like to be able to easily check which unique identifiers do not exist in a table, of those supplied in a query.
To better explain, here's what I would do now, to check which IDs of the list ...
2
votes
2answers
55 views
Postgres RIGHT JOIN with custom array
I'm using Postgres 9.1 and want to get a result with some blanks where there is no data. My query looks like the following:
SELECT institution_id FROM ... WHERE institution_id IN (1, 3, 4, 5, 7, 9)
...
1
vote
1answer
39 views
Merge multiple “is exists” queries into one statement
I'm trying to figure out how to check if multiple rows exist in multiple tables in one statement.
Given the following tables:
table table_one
========
id
'a'
'b'
'c'
table table_two
========
...
1
vote
1answer
56 views
Would I lose data if I change a column from varbinary(8000) to varbinary(max)?
Is there any data loss if a table is being altered to change an existing column from varbinary(8000) to varbinary(MAX)?
1
vote
1answer
319 views
SQL Server Login failed for user Error: 18456, Severity: 14, State: 11
I have an AD group XYZ that I have added to SQL Server security with data_reader permissions.
The XYZ group has around 10 users in there who are successfully able to access the SQL Server database. I ...
6
votes
2answers
316 views
Oracle 11g: performance improvements of inserts
I have a table of 500 millions of rows (and growing)
I did the following to improve performance of inserts:
On database side:
dropped all indexes and constraints
disabled logging
On application ...
6
votes
1answer
180 views
Landed as BI, but databases are a big WTF, what to do?
Maybe a duplicate, but I believe my case is a bit different. From one of the answers I got to this post on SQL Server Central that also comes handy too but is not quite the same scenario: 9 Things to ...
1
vote
2answers
173 views
SQL Server 2012, restore database
I am using MS SQL Management Studio 2012 to restore the database from a .bak file. (That file is from the backup of the database on server)
In my new database, the triggers are missing. Why did I ...
1
vote
1answer
106 views
Error on creating database in SSMS
I am using SQL Server Management Studio 2008. I am connect to localhost and I want to create a database. When I click on New Database, type the name and click ok, I get the message:
Index was ...
