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)

1
vote
1answer
73 views

UPSERT statement never completes, infinite loop?

Based on some of the stackoverflow answers I wrote the following UPSERT statement, which I think must be stuck in an infinite loop. I added a statement in there to avoid an infinite loop (as it would ...
1
vote
2answers
154 views

Automobile database logic

I am building a web based quoting system for a local automobile dealership. I think I have figured out the logic for the databases but I want to get a second opinion before I start just to make sure ...
4
votes
4answers
13k views

T SQL Table Valued Function to Split a Column on commas

I wrote a Table Valued Function in Microsoft SQL Server 2008 to take a comma delimited column in a database to spit out separate rows for each value. Ex: "one,two,three,four" would return a new table ...
1
vote
1answer
19 views

Count of 3 consecutive unsynced dates

I have a table set out like so: user_id the_date minutes_asleep ---------------------------- 1 2015-01-01 480 1 2015-01-02 0 1 2015-01-03 0 1 2015-01-04 0 ...
0
votes
1answer
14 views

Postgres - Inject 0 values when rows do not exist

I have 3 tables that I need for reporting: *dates* date_sk | full_date | day_number_of_month 1 | 2013-01-01 | 1 2 | 2013-02-01 | 1 3 | ...
0
votes
0answers
13 views

Are there limits to SSRS 2014 RDL files going over to SSRS 2008 (or 2012)?

Is there any incompatibility with reports developed in SQL Server SSRS 2014, and then exported to .RDL files that will be imported into SQL Server 2008?
2
votes
2answers
77 views

Moving data from table with VARCHAR(50) fields to table with numeric fields increases table size

I want to understand why migrating data in a table with all VARCHAR(50) fields to a table with optimized smaller types caused the new table (containing 61,065,164 rows) to be 4.46 GB, which is larger ...
3
votes
1answer
2k 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
3answers
35 views

How to select the largest value of the same column in multiple tables?

I have multiple tables which have some columns with the same meaning, eg., event_timestamp. The schemas are like following: Table A: ...
0
votes
2answers
52 views

SQL Multiple JOINS Interpretation order [on hold]

I have a big problem of using multiple joins in one SQL Statement. For example i have 10 Tables which they are tbl1,tbl2, tbl3,..,tbl10. I would like to select some columns from each table from tbl1 ...
1
vote
1answer
149 views

Joining on a field with different values

I am trying to join data from two completely different sources. One source contains an employee's schedule information, and the other tracks what they actually worked (like what time they actually ...
2
votes
1answer
143 views

MySQL fulltext selection performance

I have 1.5M rows in a table. Following is the table create code: CREATE TABLE `jobs` ( `id` INT(8) NOT NULL AUTO_INCREMENT, `job_id` VARCHAR(50) NOT NULL DEFAULT '', `title` VARCHAR(255) ...
1
vote
1answer
107 views

Print the execution time on messages Pane?

How I can print the execution time of each query on messages Pane? For example the Select * from tbl1 runs for 10 mins then Select * from tbl2 runs for 15mins and so on.. Select * from tbl1 Go Select ...
4
votes
2answers
694 views

How to restore a SQL Server 2008 R2 database

Here's my issue. I have a server created from a windows image that includes SQL Server 2008 and two specific windows users, these windows users are a part of the sysadmin role and are users for the ...
0
votes
0answers
20 views

Adding a second database to the same instance of a server

I already have a multi user software program running on Windows 7 work stations and the server is running Windows Server 2008r2. I am trying to setup another program using the same server. The code is ...
2
votes
1answer
2k views

Extract MySQL information from a compressed tar.gz file

I have a back up-of a MySQL database which is contained in a .tar.gz file - I need to restore it. I've never had to do this before. The only way I can access the database is through phpmyadmin. There ...
1
vote
3answers
2k views

Oracle query is slower the second time

I have a general question about something I'm seeing in performance tuning in Oracle. I have a query that I'm testing. It's too big and complex for me to provide a simple example, sorry! (I tried ...
0
votes
0answers
16 views

How to determine is a value exists in a column within a partition

I have a set of data where I need to look at partitioned data and determine if a value exists within that partition. Example data: AccountNumber Code Status Credited ...
0
votes
1answer
132 views

How to optimize query

using SQLite3 and the following query, it seems like there should be a better performing way to write this query? Is there? Select Name, Sum(Case When Used Is ...
1
vote
1answer
28 views

Trigger AFTER INSERT on tables with different columns

I'm writing a trigger that works after an insert. This is what I have: create trigger trgInsereQuestao on tblquestaoOpcao after insert as begin set nocount on; insert into ...
0
votes
1answer
19 views

Alternative to RDBMS: Modeling Exam/Testing data

I'm a born and bred relational database guy and C# programmer dude. IBM DB2 & VB.Net in school. TSQL & C# at work. I'm planning a project for fun: Designing a Testing platform that goes from ...
0
votes
1answer
22 views

How to list all past remote login information on client SQL server

Instead of using "Remote Desktop" for connecting to SQL server, I and my coworkers are using SQL Server Management Studio to apply the changes on remote server (each users have their own credentials). ...
1
vote
1answer
22 views

Alternate per 2 postgresql rows, but start over if there are rows remaining

I'm trying to select below table, grouped by two (=max, if there is only one, show one) of each supplier_id. But, after all suppliers are selected it needs to start over. So this is the table: Table: ...
0
votes
1answer
253 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 ...
0
votes
1answer
32 views

Combine two updates [on hold]

I want to combine the following SQL statements into one: Update ENGROYLIB/UCOMPFL Set AddrLn1 = 'ELECTRIC LIGHTING STATION,', AddrLn2 ...
1
vote
1answer
25 views

#2014 - Commands out of sync. you can't run this command now. Query was working before. But now it is not working

My table structure is ... There is Counter which has many Box in it. Box has a one BoxType. and Collection stores Box datewise revenue and data. I need data of particular 1 COUNTER (Data of All the ...
1
vote
2answers
72 views

How to do an =ANY(SELECT…query in postgresql?

I'm trying to select all the latitudes and longitudes for a group of users based on their id being in an array stored in another table. Here's my attempt: SELECT latitude, longitude FROM userloc ...
0
votes
2answers
246 views

Netezza Error Record size 120000 exceeds internal limit of 65535 bytes

I have a column PARAM that has JSON data that looks like this: JSON:{"Name":"RES_InformationalIssues","StepName":"Page_1","StepData":"f601e9fe-d68a-4ed7-bbaa-f40c9cbc4d12=General Product ...
0
votes
0answers
9 views

Locally connecting to SQL Server 2012 using Windows Authentication

I have a SQL Server 2012 cluster which I've updated with SP2, and since the update I can't locally connect to the server using Windows Authentication. Yet, I can connect using same credentials from ...
0
votes
1answer
18 views

Numeric Latitude & Longitude values are rounded up when querying SQL Server Database

Developing an application that is using Google Maps. Lagitude and Longitude values are stored in the table as the correct value. However when they are pulled into a view the value is rounded to the ...
1
vote
1answer
39 views

Maximum sum() of overlapping ranges

Essentially my question is: how does one do aggregate operations involving overlapping ranges in PostgreSQL 9.3 (or 9.4)? The specific problem I have at hand is that given a range, I want to find the ...
0
votes
1answer
23 views

Copy of a database with an existing database with schema and data in sql server

I have two databases one is having master kind of tables and other will have transaction data. I should create a new database with a structure of an existing database to my clients. Here is the ...
1
vote
1answer
81 views

SQL Server : scheduled JOB issue

I have one issue in my live server ... Issue is: I created a job for log file shrink & I have scheduled it for every day run with sa user When I run this job manually from Management Studio, it ...
1
vote
0answers
36 views

Is it bad practice to launch more than 100 sql statements at once?

I have PHP code that is meant to updating the billing status of someone. I only want it to update if the bill has been successfully created and therefore I think a possible solution would be to ...
1
vote
1answer
33 views

SQL Server error log entry : Error: 17806, Severity: 20, State: 14

I have error in my log for a few weeks, I searched a lot but I couldn't found useful answer. I did closed SQL Server port for public IP, but I have problem yet. Error: 17806, Severity: 20, State: ...
0
votes
0answers
30 views

Can I create a constraint to a subset of data? [duplicate]

Here's a simplified view of my database |---------------| |-----------| | ORGANIZATION | | CONTACT | |---------------| |-----------| | OrgId | | ContactId | | OrgName ...
1
vote
1answer
389 views

Optimising a query of an SSRS dataset

Consider the query given below: SELECT * FROM ((SELECT c.cust_id , c.username , REPLACE(qs.seg_type_ref_key_02, 'N/A', 'Non Vip') casino_group, ...
0
votes
0answers
24 views

table not taking records sequencially [duplicate]

While inserting rows into a table in oracle 10g, the rows are not inserted in the order I am putting them, like for the following inserts: insert into emp values (1000, 'debjani', 30); insert into ...
2
votes
2answers
384 views

How to get SQLCMD to output errors and warnings only?

How can you get SQLCMD, when executing a SQL script file, to just output any errors or warnings it encounters? I essentially dont want information based messages to be output.
0
votes
1answer
87 views

How to perform same DML statements on two different servers (Oracle and SQL-Server) simultaneously

I have two servers, Oracle and SQL-Server. I have same database on both the servers. I want to perform DML (insert,update,delete). How can I perform same DML statements on both the servers ...
0
votes
0answers
25 views

What kind of data cannot be stored economically in a database / data-warehouse?

Someone mentioned this in a presentation but didn't provide any examples. This stuck with me and I am trying to figure out what kind of data couldn't be stored economically in datbases ever since. It ...
0
votes
0answers
20 views

merge two column into single columns and show them in separate rows

My Table looks like this Name Date1 Date2 Date3 A 25 23 20 B 20 15 10 I want it like this Name Date A 25 A 23 A 20 B 20 B 15 B 10 how i can ...
2
votes
2answers
126 views

Logical problem with a database model

Beforehand the table names and columns are in Spanish, my native language is Spanish. (table names have been now edited to English) I've got a database to manage the tickets sales of a trip that is ...
7
votes
6answers
6k views

SQL Query Formatter [on hold]

Are there any (Linux based) SQL Query Formatting programs/plugins/extensions? I use PostgreSQL and MySQL but other DB's are welcome as well. I can use a VM to test with but would prefer a Linux ...
-3
votes
0answers
31 views

Backup and Restore

What are the Negative Aspects backup and Recovery in sql server Over these points. Full Backup and Restoration Point in Time Restoration Restoration in Same Instance Restoration in Different ...
1
vote
1answer
2k views

Sybase SQL Anywhere 12 - Get all indexes which are unique -> ambigious sysindexes error

we are using a Sybase SQL Anywhere 12 db. In the db there are indices, which are unique, but shouldn't be unique. Therefore I search for a quick way to list all tables with unique primary keys. I ...
1
vote
2answers
250 views

After Restore Log_reuse_wait_desc of Replication

I'm wondering if anybody has ran into this issue before and has any suggestions on what's causing it/how to fix it. We are restoring a database into lower Dev environments and after the restore the ...
0
votes
1answer
41 views

How to store multiple vendor data in Google Cloud SQL?

I am designing a mobile app in which I need to host my vendor data and give access to that data after analysis to only the specified users. Since I will have multiple vendors with different set of ...
0
votes
1answer
75 views

Replication Snapshot folder not cleaning up

The job that I thought was supposed to clean up old snapshots isn't removing the old files. The retention is left at default yet there are snapshots months old which remain. The job runs as the ...
0
votes
0answers
16 views

How to setup a trigger for updated records

Prod database "Mother" Copy of database "Father" Here's my scenario I need help with: I have a database that has a table called User_Group table on our Production db "mother". The dev team wants me ...