DO NOT USE this for questions targeting Microsoft SQL Server, use the tag sql-server instead. "SQL" is an acronym for "Structured Query Language", it is used in relational database management systems (RDBMS) to query, update, delete, and insert data as well as modify the structure of the database. ...

learn more… | top users | synonyms (1)

0
votes
0answers
2 views

sql server on big machine falls over inexplicably

We've been doing some throughput testing with our web application. The production application resides on a couple of machines in the amazon cloud, consisting of a web server and a database server. ...
0
votes
0answers
15 views

Different ways to log the DML operations being performed, along with the hostname (or some type of unique ID) performing the said operations?

What are the different ways to log the different DML operations that are being performed, along with the host performing them. I do not wish to use triggers as they are costly. I considered SQL Audit ...
-1
votes
0answers
12 views

How can i limit .ldf file size when database is configured in always on availability group [duplicate]

How can i limit ldf file size when database is configured in always on availability group.
1
vote
2answers
46 views

Copy values to another column - ORA-01481: invalid number format model

I want to copy values of col1 NUMBER(13,4) column to another newly added col1_temp VARCHAR2(50). To perform this action I build the following update query: update table1 set col1_temp = to_char(col1, ...
-2
votes
1answer
20 views

Selecting different variables depending on another variable [on hold]

I must make a new table with filling up fields depending on a variable. If type = holder, then I should take the enterprise field, if type = requester, I should take the name. How do i write this in ...
0
votes
0answers
13 views

SQL Express SA user has disabled [duplicate]

Hi we have an issue where our SQL Express has randomly disabled the SA account can I am able to connect to SQL as the local admin but it does not have sufficient access to re enable the SA account. ...
0
votes
0answers
23 views

would you help me understand errors and bad exercise containing in the query?

A customer called technical support for a DBMS, saying that the DBMS had a severe bug and was crashing the operating system. On investigation, it was found that the ‘crash’ always happened when a ...
4
votes
2answers
48 views

Charindex, Getting specific data from a string

Hello I am very new to charindex and have tried to create a query that would extract my needed information but am running into an error. I searched for similar problems on stackexchange as well as a ...
1
vote
1answer
34 views

How to use an alias name that has RANK() OVER in a WHERE clause

I have a query that has a RANK() OVER function inside it but I would like to use the results displayed on this column in the WHERE clause that follows. How do I write that as all the other questions I ...
3
votes
2answers
54 views

Conditional Foreign Key Relationship

I currently have a foreign key between two entities, and I would like to make that relation conditional to the entityType of one of the tables. Here's the hierachy of tables, this is done via FK ...
2
votes
2answers
41 views

Query to know who paid more than 10k

I have a table with payment informations, like this: ID COSTUMER_ID DATEPAID AMOUNT 1 1 2012-01-01 50 2 1 2012-02-01 100 3 1 2012-03-01 70 4 2 ...
1
vote
1answer
19 views

Recording history of ranks

Once per day, this is being executed to rank everyone in the database based on points. SET @r=0; UPDATE ranks SET previousRank=rank, rank= @r:= (@r+1) ORDER BY points DESC; The field ...
-3
votes
1answer
49 views

Retrieve result for all the users

I have one query which returns particular user total hours for a month. I want to return for all the users in an org. UserRegistration table contains UserID. My code for particular user is, SELECT ...
0
votes
2answers
27 views

select where column with a %

How can I select all records with a % in? Goes code below works? SELECT * FROM table WHERE column LIKE '%%%' first and last % for zero, one or more chars second % for the percent skinn If not ...
0
votes
0answers
42 views

How come MySQL LIKE is faster then FULLTEXT?

So, I was trying to optimize my MySQL queries, but found out that i'm actually doing this wrong. I've changed my query from using SELECT * FROM test WHERE tst_title LIKE '1%' To: SELECT * FROM ...
0
votes
1answer
29 views

How to prevent insert row duplicate value in a column and equal the any value

I have table TABLE1( id number (primary key), IDAccount number, status char(10)) Table can have 2 row duplicate (IDAccount, status) with status=disable as well as id IDAccount status 1 ...
1
vote
1answer
144 views

SELECT COUNT(*) to html table

This may be a very simple but its still not clear to me. I'm writing a SQL Agent job to generate output in html format. I need to get results of a query SELECT COUNT(*) FROM TABLE_NAME. I'm able to ...
-6
votes
0answers
29 views

i want to join the sum but different LIKE CONDITION [on hold]

Below is my table this is fill on the training_transaction table
0
votes
1answer
66 views

Is there a way to run this query in all databases ? ( SQL Server 2008 R2 )

How can I use this query for each database? I can easily use sp_msforeachdb but it breaks the results for every database. So I tried to insert the results in a temp table, but it's giving me syntax ...
1
vote
1answer
32 views

PostgreSQL, how to extract all the possible couples of a primary key in a table?

I would like to find out a PostgreSQL command that reads the content of a table, and returns all the possible couplings of the primary key of the table. Something like this: input_table (ID is the ...
6
votes
3answers
187 views

Find data size of table for several identical databases on a instance

I have several identical databases with the same schema/table structure within a instance. I need to find the size of one table that they all have. For example, I have 30 databases on a instance and ...
0
votes
1answer
43 views

Update if exist in other table

I want to update column in table A if the value of column A1 exist in one column of B table for example B2 update A set A1 = 'F' WHERE A1 in (SELECT B2 FROM B ); I tried somethig like this but no ...
0
votes
0answers
23 views

SQL TDE Key Format

I'm trying to find the Key Format that SQL TDE uses. Is it PKCS? If so, what #? I haven't been able to identify this based on research done on MS website. And, there is no mention of key format during ...
1
vote
0answers
14 views

Can i use PGP for securing My database

I have considered TDE and cell level encryption mechanism for securing my database. but these two cannot fully satisfies my requirements.through surfing i found that PGP may help me, but it is mainly ...
1
vote
1answer
339 views

Can we use TDE as an anti-injection technique

TDE prevent unauthorized access to the data by restoring the files to another server, because it requires the original encryption certificate and master key. If i applied a table level encryption ...
7
votes
3answers
83 views

Totals(sums/counts) across multiple child tables query optimization

We have 12 types of expenses in our database, some have fairly differing data minus the Amount fields. We have multiple places in the application and reports that require single and multiple expense ...
3
votes
1answer
47 views

GROUP BY uninterrupted sequence of logs for same location

I'm having a hard time describing my problem or finding it via Google. I want to be able to group rows based on location and employee, but the group should be split if a row with the same location ...
-1
votes
2answers
53 views

How can we create a table from stored procedure?

CREATE DEFINER=`root`@`localhost` PROCEDURE `create_tb_one`(In tableName varchar(255)) BEGIN CREATE table tableName( ID INT NOT NULL, SNAME VARCHAR(100) NOT NULL, ...
3
votes
2answers
89 views

TDE on Replicated Databases

I have implemented Master-Slave replication between two databases, now i have to implement Transparent Data Encryption(TDE) in master database. is it possible to implement TDE in master only? whether ...
2
votes
1answer
81 views

Postgres Count with different condition on the same query

EDIT Postgres 9.3 I'm working on a report which has this following schema: http://sqlfiddle.com/#!15/fd104/2 The current query is working fine which looks like this: Basically it is a 3 table ...
1
vote
0answers
7 views

postgresql: deleting from a view

In Postgresql 9.4, we're doing a view as a UNION of to tables A and B, and we'd like to have a single DELETED N ROWS message when we 'delete' the records in the underlying tables (via a a trigger on ...
0
votes
1answer
17 views

Restore Postgres Database on New Machine

Trying to restore a postgres database on a new Macbook Pro. I recreated the database using createdb dbname then tried to restore the old database using psql dbname < dbname_dump.bin but ended up ...
-2
votes
2answers
51 views

What does the FullAccess. infront of table mean in SQL Server query? [on hold]

What does the "FullAccess" in the below query refer to? I have a table named ReceivedClaimFact but I do not have any Schemas named FullAccess in my Database. The query runs successfully though. ...
1
vote
1answer
15 views

Query Relating Rows W/O A Corresponding Value

I have a table setup like this: ID Code DateActive DateInactive statusCode 15 20090413 null A 15 null 20090416 I 15 20100101 ...
-1
votes
0answers
36 views

How can I take table as input dynamically from user?

I am new to SQL server and want to take table name and column names as input from user dynamically. Also, need to perform cursor implementation of comparing records on it. I have completed the ...
0
votes
0answers
28 views

How do I sum the counts of entries from multiple columns? [on hold]

I have a table with two columns, id1 and id2. Such as this: I want to be able to get the total occurrences in the table of the ids, which would look something like this: +-----+-----+ | id1 | id2 | ...
1
vote
1answer
46 views

Aggregation by positive and negative values

I have a table called "PROD_COST" with 5 columns: +----+----------+------+-----------+-------------+ | ID | Duration | Cost | COST_NEXT | COST_CHANGE | ...
0
votes
0answers
11 views

How to download sqlplus for running sql commands in windows 8? [closed]

I am sorry, for bugging you all with a very silly question probably, but I just started learning data base management system, and today I attempted my first sql class where I had to login by providing ...
0
votes
1answer
22 views

Joining two tables [closed]

How do I select all data from one table, based on all data selected from a different table? For example: Table 1: categories +-----+------------+ | cid | category | +-----+------------+ | 1-9 | ...
0
votes
2answers
53 views

ORA-01830: date format picture ends before converting entire input string

I am trying to run the query on an Oracle database select to_date(trunc(sysdate) || '13:00:00','DD-MON-YY HH24:MI:SS') from dual; and get the error ORA-01830: date format picture ends ...
0
votes
0answers
35 views

column values combination

I have chains of nodes like A -> B -> C -> F D -> E and store them in an Oracle table pair with 2 columns left_node and right_node left_node right_node A B B C ...
-3
votes
0answers
24 views

Program scrambled the screen [closed]

I am having problem with my program I purchased. Program is in vb and database used is SQL Server 2005. Problem is that when I used to enter or query certain no of data its screen scrambled and I ...
0
votes
0answers
25 views

Normalize to 3NF Question - Postal Codes/City [duplicate]

Normalize to 3NF and design an ERD for the following data: Name Street City Province Postal Code Home Phone Cell Phone Just want to see if I am doing this right. PERSON NameID Name Phone Number ...
2
votes
2answers
64 views

Add a flag when certain conditions are met

I have a table where when an employee works LEAVE1 and LEAVE2 paycodes on the same day then in the new column called 'FLAG' we need to put a 1 for LEAVE1 and a 2 for LEAVE2, when these paycodes are ...
-1
votes
0answers
28 views

What's better and faster — MySQL or XML based Filesystem [closed]

Good day, my boss is trying to push a project to be used with a CMS called "Weblication". Weblication is a PHP Framework using only files in XML and processing everything with XSLT and PHP. So all ...
0
votes
0answers
15 views

Is there a way to set the data source in Report Manager for whole folder rather than each report?

I have few reports under different folders in Report Manager. Is there a way to set the data source for the whole folder rather than each report individually? There is also a folder where reports ...
0
votes
0answers
10 views

Create Trigger to increase the latest duplicate number [closed]

I'm using SQL DB I need to create a trigger that if find duplicate in a specific filed 'driver.encoding' the latest duplicate value should be updated by increasing the value of the record 7th digits. ...
4
votes
2answers
18 views

Improve performance for order by with columns from many tables

Using PostgreSQL 8.4, I'm trying to consult two tables with 1 million records using order by with indexed columns of the two tables, and I'm losing performance (with 1 column takes 30 ms and with two ...
-3
votes
1answer
48 views

How does Oracle handle types in this UNION query? [closed]

SELECT 1 FROM DUAL UNION SELECT '2' FROM DUAL; what does this give? knowing dual is default table and is a single row table.
1
vote
1answer
14 views

MySQL get previous record and compare

Need to make a Comparable between the records of this table and take the total times the value calledstationid 42 preceded the value 34 (this is a system log table and calledstationid is not an ...