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
2answers
3k views

Getting SQL Server query history

I have used below query to get the history queries on ran SQL Server but it's not giving me the whole history it just returns queries ran on nearly about last 1/2 an hour. I want to get the queries ...
4
votes
2answers
11k views

Primary filegroup is full SQL Server 2008

I have a large table (~50 million rows) I'm trying to bulk insert into SQL Server and I get the error: Could not allocate space for object 'myDB' in database 'I 3 Stroke' because the 'PRIMARY' ...
1
vote
2answers
315 views

How to link each column in sql?

I have been working around on a query given by one of my developers who works on crystal reports as a junior DBA, I always like to help them even though I am busy with other things as it will increase ...
5
votes
3answers
4k views

What are the advantages and disadvantages of storing binary data in a SQL table vs a network drive? [duplicate]

Possible Duplicate: Files - in the database or not? I've been reading "Programming Entity Framework Code First" ...
1
vote
1answer
191 views

is it reasonable to use NoSQL for my project

Imagine you want to write a webapp for selling your car online. A car has a lot of attributes. Like how many doors, color, aircondition, etc. Some of them are simple boolean values, others might need ...
3
votes
1answer
483 views

Outer Join vs Dummy Rows

I found that in a dimensional layout, it is beneficial to create a dummy row in the dimension to avoid writing LEFT OUTER from the fact table. There are other reason for this aside from perceived ...
1
vote
4answers
3k views

Can't create user in SQL Server

Hi guys when I try to create user for my database I always encounter this kind of error. This is the sequence of task I done. I manage to create new login using windows authentication of SQL then ...
0
votes
1answer
6k views

To drop a table, do I have to drop all foreign key constraints or can I just NOCHECK them?

I know you cannot drop a table that has active foreign key constraints. So I was wondering is it safe to: ALTER TABLE myTable NOCHECK CONSTRAINT all DROP TABLE myTable Rather than dropping the ...
2
votes
2answers
109 views

Index included columns

After running a fairly hefty query, the execution plan gave me a missing index suggestion which was of the form: (Timestamp) INCLUDE (CustomerID, EventID, ID, EmployeeID) Which seems to be a ...
1
vote
0answers
182 views

Calculate lower and upper quartile of SQLiteDB via query

I want to calculate the upper and the lower quartile of the value what I call "diffs" in these fiddle with my DB and the query How can I do this with SQLite? There's an extension on the ...
1
vote
1answer
434 views

Set based solution to group multiple rows within a sequence

Using SQL Server 2008 and a set based solution, how could I manipulate the following data: GroupID Code StartSeq EndSeq StartDayNo EndDayNo 1755549 3506 0 0 59442 ...
3
votes
1answer
2k views

sql error 1241 operand should contain 1 column

This is my query select * from players where sport='football' and position='DEF' and pname!='Binoy Dalal' and pname not in (select ...
5
votes
1answer
2k views

Oracle extract slow function call from a WHERE clause

I have an oracle table in which dates are stored as the number of minutes since a specific date. It looks something like this: CREATE TABLE MY_TABLE ( SOMETHING NUMBER(15,1) NOT NULL, ...
3
votes
2answers
2k views

Query: All employee with sum of salary > 500

In my MYSQL Database COMPANY, I have a Table: Worker : mysql> DESC `Worker`; +--------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | ...
1
vote
2answers
1k views

Factoring out subselect (with clause) ends in ORA-00904

I am trying fo factor a repetitive subquery with with but getting ORA-00904 over and over again. This is my base query which works quite well: select tka.id, tka.name, txt.text as langname, ...
0
votes
1answer
96 views

Logging of incorrect row in SQL Server Integration Services

I newbie to SQL Server Integration Services and I have a problem: Data loaded from file looks like this: 1 'a' 'b' 2 'a' 'b' 1 'c' 'd' And this rows would be loaded in table like this: CREATE ...
1
vote
1answer
195 views

Query for localization app

Here are my tables: mysql> SELECT * FROM locale; +-----------+---------+ | locale_id | value | +-----------+---------+ | 1 | English | | 2 | Deutch | | 3 | French | ...
0
votes
0answers
86 views

Which mysql server 5.5 variables would be involved in queries locking in sending data state?

A large portion of my queries (~58%) be it for queries with previously quick return rates or other, are spending in my monitor as sending data. I made some configuration changes but it was very broad ...
3
votes
3answers
613 views

How do I go about creating this SQL query?

I'm attending the free DB course at Stanford Online, and frankly one of the exercises gave me some trouble. I have a feeling that this should be horribly simple, so for a DBA, I'm obviously not very ...
2
votes
1answer
660 views

SQL Server Error 833 On LDF File

I'm getting error 833 on my ldf file and i'm getting it a lot. Please see the following. When this happens, my application is hang already. I know error 833 has been reported a lot, but what does it ...
2
votes
0answers
558 views

Best book on query optimization, rewriting, refactoring [closed]

I have a specific problem: huge amounts of Web-related data in Postgres db. The queries running against the data are often very inefficient. But in a more general sense, I need a book that explains ...
0
votes
0answers
445 views

RAND in T-sql function

Can any one tell why t-sql not allowing using RAND function in side a function SELECT CAST (RAND() * 10000000 as varchar(20)) the error is Invalid use of a side-effecting operator 'rand' ...
1
vote
1answer
2k views

SQL Query Killed, remains in Kill/Rollback with estimated time increasing

I killed a transaction and now it remains in Killed/Rollback status and whenever I run Kill 64 with statusonly I get this output: SPID 64: transaction rollback in progress. Estimated rollback ...
1
vote
1answer
79 views

What is a proper way to handle a “sequence number” like field?

The fields of a trimmed-down version of a database I'm working with looks like this: Model Number, Model Name, Customer, Date, SeqNum The customer can purchase the exact same item on the same date ...
3
votes
2answers
102 views

SQL server 2000 transactions with the same time

I have a BIG problem here. I'm creating a program that can be looping if the connection to the server is broken. But when the program is running for a few months, I found a bug on SQL server 2000. I ...
2
votes
2answers
235 views

INSERT succeeds but all inserted values become NULL

I tired to execute an insert directly from phpMyAdmin as follows: INSERT INTO oracle.PLAYLIST_MUSIC ( TID, ID, STATUS, CREATED_BY, ...
0
votes
2answers
2k views

How to select row and column name where field is null?

I wanted to show row and column where field is null. i already see this example here but i don't understand xml code. my code is like this if exists (select * from Header where [name] is Null ...
2
votes
1answer
221 views

Setting up simple question & answer database

I am having trouble thinking this (simple) table relation through. I am setting up a quick SQL DB to populate labels and textboxes dynamically on screens. This is just to prove we can do it, so it ...
4
votes
1answer
230 views

Is there a standard way to replace codes with values from a lookup table for reporting or analytics?

Suppose I have a "main" table that was probably heavily normalized and consists largely of columns that merely contain codes that are lookups into other tables (they are probably foreign keys but feel ...
5
votes
2answers
109 views

Algorithmic order of table indexes for table operations

I have not been able to find a clear indication of the impact table indexes have on the algorithmic order of table operations. I am not interested in the nuts & bolts of specific implementations; ...
0
votes
0answers
3k views

0x84BB0001 Error when installing SQL Server 2012. Could not create a handshake [closed]

I have hopelessly attempted to install SQL server 2012 onto my 64 bit Windows 8 machine. The database engine always fails to install with error 0x84BB0001. Native reporting also fails, I reckon from ...
1
vote
1answer
357 views

How to delete and create user remotely on SQL Server 2000

My boss wants to make sure that no one runs a job accidentally so we are setting up lots of safeguards to ensure that no one sleepwalks, log into the system and run a job. We are updating the ...
1
vote
3answers
243 views

How can I best combine 3 queries into 1?

I need the following queries combined into one query that returns the following from all results from the first query you see below (Right now I load the first query into an array in php then run two ...
4
votes
2answers
361 views

Insert with 0 Writes?

I've been looking at some SQL Profiler traces recently, and I see something I don't understand. I'm running simple INSERT commands: INSERT INTO Foo (ForeignID, FileExtension, MimeType) VALUES (1, ...
1
vote
1answer
541 views

MySqli - select from db based on time difference with CURTIME() or SUBTIME()

I have a db with some customers data. There I store their last login time as datetime. I want to run a cron php script every min which will query mysqli for their last login datetime and if that was ...
2
votes
0answers
246 views

Last Known Successful DBCC CHECKDB

I understand that looking at DBCC PAGE is supposed to show me the last known good DBCC CHECKDB but I am not seeing this work correctly. I have a database that I know is corrupted. If I run DBCC ...
0
votes
1answer
126 views

clustered index - data warehouse

My source data comes from multiple OLTP databases where the primary key is an identitiy column. We anticipate adding data centers and/or splitting the databases by product. Currently i have one system ...
-5
votes
1answer
7k views

how to query multiple row data in single column in oracle?

i have a table in which the values are id value ---------------- 1 10 1 20 1 30 2 33 2 34 I want the output given below using sql: id value ...
2
votes
3answers
2k views

SQL Subquery , One to Multiple rows

Following query I have written returns the result as expected, example 121350 rows. SELECT dbo.Articles_in_Consignment.Consignment_id, dbo.ORDER_D.Orders_boxsize, ...
0
votes
1answer
3k views

Save output from multiple SQL SELECT commands to a file

Within a Postgres function I would like to run a number of SQL SELECT commands and append the output to the same variable. After all the SELECT commands have run this output should be written to a ...
0
votes
0answers
25 views

SQL services wont start due to incorrect drive letter [duplicate]

Possible Duplicate: SQL services wont start due to incorrect drive letter after windows restore SQL services wont start due to incorrect drive letter after windows restore Had a server ...
1
vote
1answer
215 views

Storing Different Products and Joining on table Names

I am setting up a database using mysql to store different products with different product types. For example I could have Books, Software and clothes etc. What I am think of is creating a parent ...
0
votes
1answer
83 views

Is there any way to get recently inserted value in a table without using aggregate functions?

I tried to get the users list who are all accessed our application in past 6 months . In our table , we are storing login_time , user_id ..etc . It's a huge table approximately it will contain over 3 ...
4
votes
2answers
214 views

Performance on SQL Join

I have a query which takes ages to run mainly due to a join between 2 tables on a PK and FK. The Key is prefixed with 2 letters (which is always the same, RN) followed by 7 digits So RN1234567 for ...
1
vote
1answer
154 views

cloud computer to speed up sql big data queries?

i have been doing a lot of data mining at my new job. we collect TONS of data, and it's my job to visualize that sea of information in real time with statistic/heuristic analysis. we're currently ...
1
vote
2answers
851 views

ERROR: could not find array type for datatype information_schema.sql_identifier

I am trying to run the below sql command: SELECT ARRAY( SELECT column_name FROM information_schema.columns WHERE table_name ='gis_field_configuration_stage' ); and I get the below ...
2
votes
1answer
107 views

Finding similar values in columns

For example I have a column id and column email. I would like to find all values from id and column that share similar pattern. let's say: in id 'column' I have Alexander and in 'email' column - ...
3
votes
1answer
924 views

Error while restoring database in SQL Server 2008 R2

This error occurs while I restore database from .bak file A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software ...
0
votes
1answer
349 views

MAX function and group by usage - postgresql

I am building a ranking algorithm using IMDB's formula: http://stackoverflow.com/questions/1411199/what-is-a-better-way-to-sort-by-a-5-star-rating/1411268#1411268 The formula for calculating the Top ...
1
vote
1answer
1k views

SQL Server job failure

I have a job that executes every 15mins on SQL Server 2008 and it comes up with the following error at least once in two days. But, it runs successfully the next time it runs. The account that is ...