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)

0
votes
0answers
8 views

What is role of adaptive server in sql server?

When we run a stored procedure, Adaptive Server what will do.
2
votes
1answer
135 views

Allow non-sys admin, non-owner of a job to execute it

I have a job that runs an SSIS package. Currently the owner is a proxy account. I can run the job manually from a sys-admin account. Our web service logs in using a limited account. It needs to ...
2
votes
2answers
143 views

How do I include nulls during comparisons in SQL Server?

So basically in SQL Server a NULL means there is no value and thus can't be compared which returns some unexpected results. For example, the following query doesn't return rows where value IS NULL ...
0
votes
0answers
19 views

Errors in the metadata manager. The process type specified for the Effect dimension is not valid since it is not processed

Trying to hunt down an issue with an SSIS package we have and I don't know what to look for to help correct this issue. Error: Errors in the metadata manager. The process type specified for the ...
0
votes
1answer
20 views

Adding a constant IF not in an other table

So I have this query. SELECT * FROM `Comment` WHERE `Target` = '".$_GET['pp']."' AND `Id` NOT IN (SELECT `Target` FROM `Delete` WHERE `Type` = 'comment') ORDER ...
0
votes
2answers
43 views

SQL Server 2000 : Upgrade from Personal Edition to Enterprise Edition

I've never tried this before but this is what I'm attempting to do : Backup all the databases Copy current master.mdf and master.ldf to another location (for later purpose) Uninstall SQL Server ...
0
votes
1answer
12 views

Mysql Select using Alias

I Need to filter the query that have some conditional column as below: SELECT `c`.`fullname` AS `fullname`, IFNULL(`c`.`new_ic`,`c`.`old_ic`) AS `Ic`, `bla`.`loan_no` AS `Loan_No`, ...
0
votes
2answers
58 views

SQL Server 2008 R2 memory issue

I have read many posts regarding the memory but still its not clear. I have dedicated server SQL Server 2008 R2 with Windows 2008 R2, 32 GB RAM, 2 6 core processor and a database of around 60 GB on ...
0
votes
1answer
37 views

I am not sure why I am getting the “Invalid column name”, same code works on my other calculators… [on hold]

In the following code: sqlCommandString1 = "Select Correction FROM Wlookup " + "WHERE Citystate = " + ComboBox1.Text Citystate lookup to result correction value. There are no spaces, and I tried ...
1
vote
2answers
34 views

Aggregate function / query in Oracle 11g

I am working in Oracle 11g. I have been racking my brain all day trying to figure out how to write a particular SQL statement (am a Java/.NET Developer, would not consider myself a SQL expert) I ...
0
votes
0answers
10 views

Get travel_point.address_from and travel_point.address_to when driver_has_book.status is 0, 1 or 2

I'm building a view for get travel_point.address_from and travel_point.address_to when driver_has_book.status is 0, 1 or 2 (basically I'll need another data from related tables). I leave the SQL ...
1
vote
2answers
76 views

Long running simple query SQL Server 2008 R2

I have a very simple query running in a SQL Server 2008 R2 instance: SELECT TOP 10 * FROM messages m INNER JOIN recipients r ON m.id = r.id WHERE m.timeStamp > '2014-07-14T00:00:00.000' AND ...
0
votes
1answer
55 views

Database revision needed for sports events database

This is not a code review but more of a database schema review. I have a sports events website that I am doing in my spare time. I need assistance with the database design. I am about 80% completed. ...
0
votes
1answer
33 views

Building a query programatically

I have three variables $color, $size and $category. Each oh them can be a specific value or may refer to all entries.I want to fetch all products that are $color = "red", $size = "Medium" and any ...
-1
votes
0answers
44 views

Do we need to write Primary key of a table as foreign key if it is primary key of another table? [on hold]

I am a beginner in Sql. I have a table named DRIVER and another named CONDUCTOR DRIVER Primary Key- Bus_id CONDUCTOR Primary Key- Bus_id My question is do i need to specify Bus_id as Foreign ...
3
votes
2answers
69 views

How to inner join some tables and outer join others?

I'm certain I'm going to be embarrassed by the eventual answer, but I've been googling around and banging my head against the wall and can't figure it out. I have four tables described below. I'm ...
0
votes
2answers
32 views

Sql statement to compare two table

I have two table with the same structure, i want an sql statement to compare them and see any modified line, deleted or added Table Product1 : ________________ |Product | Price| |Product1 | 10 | ...
0
votes
1answer
37 views

select multiple columns group by one with inner join

I have a problem with group by, i wanna select multiple column but group by only one column these below code which is i am used but its given a error. SELECT ...
1
vote
2answers
47 views

What subquery do I need to calculate this report?

I have two tables: tickets and comments. I need to run a report that shows me which ticket is "neglected" meaning that there has not been a comment in X amount of time. If I was to do this in PHP, I ...
1
vote
1answer
34 views

pass data from deleted table to another

This is the situation: I have a table, with name TABLE_1 I would like delete TABLE_1 and then create another table with the same name and some of its columns. TABLE_1 has records, but I need to pass ...
0
votes
1answer
41 views

ORA-00933: SQL command not properly ended

I have created a database link to a remote database, MIGRERDOSSIER.US.ORACLE.COM, then I use it to insert records in a table in a local database. Here is the request I am trying to execute: insert ...
0
votes
0answers
24 views

Package body created with compilation errors [on hold]

I run it in sql*plus but always get this message: Warning: Package created with compilation errors. CREATE OR REPLACE PACKAGE BODY Admission_pkg IS ID_Var Tbl_Dept_Info.Dept_Id%type; ...
0
votes
1answer
15 views

Date format on the output of cmdshell dir C:\ /TC

I would like to ask you guys if anyone of you had this trouble before. In SQL I read the create time of the file like exec master.dbo.xp_cmdshell 'dir C:\ /TC' which gives me; 07/14/2009 04:20 ...
2
votes
2answers
75 views

Way to do MERGE with update source when target not match?

I am trying to write a stored procedure that will take new values from a temp table, merge them into an actual table, giving me the ids of the inserted rows, and the rows that already exist matching ...
3
votes
3answers
157 views

Nested table as condition prevents using index

The following query joining a subquery does a TABLE ACCESS FULL when the master-table uses nested table as condition. When the condition is a simple =, the same query does an INDEX RANGE SCAN as ...
-5
votes
0answers
34 views

Microsoft SQL Server 2008 error 29 [closed]

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and ...
0
votes
2answers
57 views

Difference Between SELECT and select in oracle sql

The algorithm used to find SQL in the library cache is based on the ASCII values of the characters that make up the statement. Means The SELECT instead of select statement will be parsed again ...
1
vote
2answers
55 views

Get only the oldest entry in a join

So I have a table bugs |bugid| title| the table is lacking a date column. But when creating a new entry, most likely always a new entry gets created in bugnotes as well saying "bug created" with the ...
0
votes
0answers
27 views

How to join the latest previous record with SQL

The original question was posted on stackoverflow. I think this site could be more focused on db related topic. I have a table whose schema is like this: CREATE TABLE product_shipping{ product_id ...
0
votes
2answers
75 views

Query Optimization required - Subquery using Inner Join

Could anybody advise how can I optimize this query below please? SELECT IT.[iInternalTransactionID] , IT.[iInternalAccountID] , C.[iContractID] , IT.[dtTransactionDate] AS TransactionDate , ...
-1
votes
2answers
29 views

Trouble quering a join in oracle sql

Theres a question on an exercise which asks me to write an SQL statement to show the SKU, SKU_Description, WarehouseID for all items stored in a warehouse managed by ‘Lucille Smith’. I have to use a ...
1
vote
1answer
12 views

Select the last logged change before a specified time from a change list

I want to get the last change for all issues issue, that was made before a specified end time. I have 3 tables. projects +---+------------+ |ID |project_key | +---+------------+ |1 |bug_tracker | ...
0
votes
1answer
51 views

How to INNER JOIN and OUTER JOIN within the same table?

I am using PostgreSQL and I have the following tables: Product ID | Name | Price Receipts ID | Month | Quantity | Product_ID (FK) Sales ID | Month | Quantity | Product_ID (FK) I am trying to ...
0
votes
1answer
25 views

Demo DB for book on PostgreSQL

The book PostgreSQL: Introduction and Concepts, printed in 2000, was highly recommended to me by the regulars in PostgreSQL IRC channel. However - I was trying to figure out which demo database ...
0
votes
1answer
33 views

Batch converting indexes to keys [closed]

I have a legacy MS SQL Server database where all the primary and foreign keys were created as indexes. I am developing the new version of our software with Entity Frameworks, which I have learned ...
0
votes
0answers
11 views

A better database model for level of product-information in service and maintenance environment

This is a tough question and rewriting it now for a couple of times. I have a question about a good, more solid way to design my database model about service and maintenance. My main problem are the ...
0
votes
0answers
20 views

SQL Server very slow response

Sql server 2012 is very slow in response to any query from the application. Even using SSMS to try connect often results in time-outs. The log files were recently moved to their own drive as they were ...
0
votes
3answers
42 views

Oracle Export using EXPDP gives ORA-06512 SYS.UTL_FILE error on Windows 7

I am using Oracle 11g and want to export a table using below statement C:\>expdp SYS/sys@MYDATABASE DIRECTORY = Mydir DUMPFILE = Customer.dmp LOGFILE = Customer.log TABLES = PERSON.CUSTOMER ...
4
votes
2answers
729 views

Is it possible for SQL Server to miss rows on a select * where PK = “value” query

We have just migrated an application to an SQL Server 2008 R2 from SQL Server 2005 and moved from a physical to virtual hosting environment. I have a very strange error in our application and I was ...
0
votes
2answers
32 views

Query Cache Implementation Details

I am new to DBA stack exchange & this is my first question. Kindly help me in finding a low level documentation for Query Cache module in MySQL since I am planning to work with the source code of ...
1
vote
3answers
97 views

Preventing SQL Injection

I know that this is very dangerous: EXEC sp_executesql 'SELECT * FROM ' + @Table But, is this safe from SQL injection? IF EXISTS(SELECT * FROM information_schema.tables WHERE TABLE_NAME = @Table) ...
1
vote
0answers
16 views

Update Only Rows With Shared/Similar Value [migrated]

OK - I have a simple table - below - what I am trying to do is to identify only those rows that have a shared value - so anything that has a shared "apc" value - DO x else Do Y CREATE TABLE #test ...
1
vote
2answers
70 views

Restoring MySQL Tables from .ibd, .frm and mysqllogbin files

For some reason, when I try to open up my tables that are stored in .frm and .ibd files (whether on MySQL or phpmyadmin) it gives me a syntax error or it says it does not exist. I've read the other ...
2
votes
2answers
67 views

I need help optimizing a not that complicated query that returns unexpedcted performance problems

I have a table that stores details about incoming and outgoing phone calls such as when a call was made, or when a call was received, the phone number of the caller, and the phone number of the ...
0
votes
1answer
33 views

Sql Server sys.Traces log

Working with traces on production server I found some mysterious entries to me in sys.Traces, When I run below query it shows me status of all traces as ‘Paused’ along with entries in ...
1
vote
0answers
43 views

Database Structure Definiton

This is a question more so on the table definition vs actual programming. I have 6 sets of potentially 255 unique fields. I have a potential of getting 40 million records per year of these. For the ...
1
vote
2answers
19 views

getting one day timestamp in mysql

Please consider the following stored procedure I have: ORIGINAL Stored Procedure: -- -------------------------------------------------------------------------------- -- Routine DDL -- Note: comments ...
1
vote
1answer
47 views

How to make the SQL query more efficient?

I use mysql under Linux. My table is about 8000000 rows. The table has index(advertiser_id,activity_date),(activity_date,advertiser_id,activity_type). The table is looks as following: activity_date ...
0
votes
1answer
36 views

Problem with foreign keys

I do ALTER TABLE bdt.auth ADD CONSTRAINT `depositor no.` FOREIGN KEY ( `depositor no.` ) REFERENCES bdt.depositors( `depositor no.` ) ON DELETE CASCADE ...
0
votes
1answer
17 views

Creation of a simple field failed in MySql [duplicate]

CREATE TABLE bdt.transactions ( `transaction no` int UNSIGNED NOT NULL AUTO_INCREMENT, data date , by int NOT NULL , hours int NOT NULL , ...