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
1answer
56 views

Use serial ID for multiple columns and return it from INSERT

I am using Npgsql and I want to be able to do an insert, and if statement that will do an update and then return a value so when ExecuteScalar is called it reads that value. This was done fine in ...
0
votes
2answers
76 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
24 views

pre-process, anonymize, data before creating a dump from sql-server [closed]

I would like to be able to automatically create dumps from a production machine (SQL-Server 2008R2 and up). In those dumps some data needs to be anonymized (mainly by scrambling nvarchar-fields) so no ...
0
votes
1answer
51 views

Alternative to sub query in MS Access

I'm looking into the possibilities for writing queries in MS Access, as my client currently uses Access and would be reluctant to move away to SQL Server. I've been using the data macros (which are ...
0
votes
1answer
84 views

Why isn't this index helping my InnoDB MySQL query?

I'm having trouble understanding why an index I have on one of my tables is doing nothing to help the performance of a JOIN, even when forcing the index. Here is the query: EXPLAIN SELECT * FROM ...
2
votes
1answer
52 views

Adding Indexes To a Partitioned table in SQL Server 2012

I have recently converted our one large table to use table partitioning in SQL Server 2012. It's a table that stores logs based on a time. So I created a partition function to split the table on my ...
0
votes
0answers
28 views

Cant Normalize my dimensions and fact table, need help

I have a task at school that I can't get my head around. The task is to create some dimetables and create a facttable from those. The data I have chosen is from Export and Import cost for each year ...
0
votes
1answer
32 views

How to include in the result of a `SELECT … GROUP BY …` all the other columns that are functionally dependent on the grouping ones?

I'll base this question on a toy example. Let this be table A: A ------------------------- U | V | W | X | Y | Z ------------------------- a | b | c | 1 | 6 | 8.3 a | b | c | 1 | 4 | ...
4
votes
1answer
81 views

Encoding Debug UTF8 & Latin 1

We have on our DB some international people that got some characters saved incorrectly on our DB (MS SQL-Server 2008 R2). For example we have strings like 'WilcoxonÃ'. We got this data into ...
1
vote
0answers
19 views

Oracle - physical writes to an index

We have a large UPDATE (affects about 200K records) on a huge table (80M records). Due to a coding mistake, the UPDATE updates the same set of rows (200K) all over again with the exact same value. ...
1
vote
1answer
45 views

Writing a view that caches to another table

I have a table market_trades with columns timestamp, market_id, and amount: api_production=# \d market_trades; Table "public.market_trades" Column | ...
0
votes
2answers
51 views

Update specific records of table based on subquery's output (sql server)

have this query which produce below output : select sec.site,sec.Name,sec.Freq from ( select Name from sec group by name having count(Freq) > 3)as dt inner join sec on dt.Name = sec.Name where ...
0
votes
1answer
57 views

Find Without primary key Table in SQL Server 2008 R2? [duplicate]

This is my query to find out primary key, foreign key in SQL Server 2008 R2: select * from information_schema.table_constraints where constraint_type = 'PRIMARY KEY' Know I need to select without ...
1
vote
1answer
29 views

SQL Query to export

I have one query to export to an excel file. var query = "SELECT * FROM indisponibilidades WHERE estadoIndisponibilidade = 'ABERTO' OR dataInicio = '" + dataPedido + "' OR dataFim = '" + dataFim + "' ...
1
vote
0answers
40 views

What will do After Press F5? [closed]

select * from Employee; Name id Col1 Col2 Row1 1 11 1 Row2 2 12 3 Row3 3 13 30 Row4 4 14 44 Above is my table After PRESS F5 What process is running in Background ...
1
vote
2answers
97 views

How to add an “INCLUDE” part in an Index Created as a part of CONSTRAINT

I am going through the execution plan of a tsql query. There is a key LookUp (Clustered) in the plan. To avoid this Key LookUp, I tried to Include a column (Status_Ind) to The Index (The Index ...
0
votes
1answer
32 views

Postgres get rows where a field stopps growing

I have a table which has the following structure id SERIAL PRIMARY KEY, device_id INT REFERENCES(another_table), uptime TIMESTAMP Every device is pinged every N minutes. The application logic and ...
0
votes
0answers
12 views

Curious Regarding filtering behaviour and performance of where condition

So i have completed the clean up of SQL code that involves four set of queries that partially do the same filtering in where condition , while the rest of the part do their own task specific to each ...
0
votes
1answer
33 views

Combining data of multiple rows in view

I have a table that holds timetracking data of users and looks somewhat like this: projectid activityid worklocationid year week day hours 1 22 21 2014 37 ...
0
votes
2answers
67 views

Group by + Order by Behavior Explanation? [duplicate]

Suppose I have: Product(_id,Name) Provider(_id,Name) Provides(ProductId, ProviderId, Price) If I want to obtain the providers who sell the most expensive products, and whose name starts with A. ...
0
votes
1answer
36 views

SSMS 2008 / 2014 showing different values for TempDB file sizes

Here's a fun one. Last week I reconfigured the initial file sizes in our tempdb database to 1GB each. We had an event a few weeks back that locked up our server due to a table with no indexes ...
0
votes
2answers
68 views

Querying MySQL, duration increases 10x fold after adding one more Join

I have a somewhat complicated query consisting of many joins on an issue tracker/project management database in MySQL. My issue is that my query was doing OK while I was in the process of building it ...
0
votes
0answers
58 views

Suitable database to store GPS track data

I have a network of vehicles. Each vehicle is equipped with a GPS sensor sending data over 3G to my FTP server. As a first solution to test the sensors, each vehicle sensor sends a .csv file to the ...
0
votes
1answer
35 views

Tables not showing in database [closed]

I create a database named Anandschool and tables inside named teacher inside database. when i see in right hand side in database then it shows only system table but when i apply command ""select * ...
2
votes
1answer
254 views

Disk Crashed, NDF(Index) file lost

I have database with : -two filegroups (PRIMARY and INDEX) -three files .mdf(data), .ndf(index) and .ldf(log) every file is on different disk, yesterday disk where was NDF file crashed so I lost ...
0
votes
0answers
42 views

LIKE or CHARINDEX to check String Contains a Substring [duplicate]

To check a string contains a sub string or not we can use [LIKE] or [CHARINDEX]. I know that like uses indexing in case we have name%.(while %name% may not use index) .Also charindex does not use ...
0
votes
1answer
18 views

Script for listing tables having no primary key oracle 9i

I'm looking for a script to find tables within my database that have no primary key.
1
vote
0answers
67 views

Connection to SQL Server failed. A network-related or instance-specific error occurred while establishing a connection to SQL Server

I'm getting this error while trying to connect to sql server. Now this never happened before and it's really annoying. I found out in my sql configuration manager that SQL server service has stopped ...
1
vote
1answer
55 views

How to match a version of SQL Server 2008?

It is needed to install a new instance of SQL to the existing Windows SQL Server 2008. I have no idea what was used to originally install the existing 4 instances. Is it R5 SP32? Thanks to MS ...
2
votes
0answers
64 views

Can there be any case where it would require additional indexes while all columns compose primary key

Ok i don't know whether this question is asked before or not Here my table SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tblProductPagesFeatures]( ...
1
vote
1answer
141 views

Why isn't SQL Server using my non-clustered index and doing a clustered index scan?

Here are my full tables: CREATE TABLE [dbo].[tblCrawlUrls]( [cl_IdUrl] [int] IDENTITY(1,1) NOT NULL, [cl_CrawlNormalizedUrl] [nvarchar](200) NOT NULL, [cl_RooSiteId] [smallint] NOT ...
2
votes
1answer
40 views

IOPS on Amazon RDS

I'm very very new to AWS. Is one insert record operation on an Amazon RDS table counted as 1 IOP? I have a use-case of inserting about 1 million records every day, and would like the job to finish ...
-1
votes
1answer
47 views

How to create procedure for this problem [closed]

I want to create a procedure to send data from one table (abc) to another table (xyz) and that data is moved to second table(xyz) only when that data is deleted from 1st table (abc)... insert into ...
3
votes
2answers
46 views

idiom to treat empty result set as zero

This is obviously a SSCCE. I have an inventory table that holds the number of items (numOfItems) in a warehouse at any given date (inventoryDate). Both are integers to keep things simple: CREATE ...
2
votes
1answer
55 views

Running a query on an improperly indexed, 600gb table

This is my first post on here and I'm really baffled by this. I have joined a team and somewhere in the past a horrific table was created which has been bloated to a point of 600+gb of data. ...
0
votes
1answer
31 views

Access write conflicts with views and insteadof triggers?

I have a legacy linked table in a msaccess database that is linked to a sql-server table. The linked table is being synced periodically to a different set of tables that have been split up for ...
0
votes
1answer
35 views

num_rows in dba_tables not reflecting the real number of rows in tables Oracle 9i

I'm querying dba_tables in order to get a listing of tables and their rowcount with following sql request : select * from dba_tables where owner='dbSID'; But I notice that even for some non empty ...
0
votes
1answer
33 views

I need to insert data from one table to another after casting the values

i have #temp table containing all details to insert into table(named:Customer) The column names of two tables are exactly equal,but datatypes are different.So i need to cast it before insert into ...
2
votes
1answer
94 views

Converting Cursor based filtering logic to CTE based

I have a cursor that runs long for about minutes which I was able to reduce to run in seconds using a CTE (Common Table Expressions). The result set was identical until there was given a condition ...
0
votes
1answer
27 views

column value is not increment after 10

I tried below 2 codes.... showing same error 1.SELECT columnname FROM tablename ORDER BY columnname DESC LIMIT 1 SELECT MAX(columnname ) AS max FROM tablename I am trying to increment value of ...
0
votes
3answers
126 views

get row count of last select query

I am using a scheduled script which exports the (new) rows of the PostgreSQL database into a textfile. There are also several instances of this script running for several DBs: COPY (SELECT ... FROM ...
0
votes
1answer
30 views

Sales by month cross tab query using pivot

I am trying to show sales by month using PIVOT in Sql Server 2005. I know it's a common question, but I just can't figure out what I am missing here: select ShippedYear, 1 as Jan, 2 as Feb from ( ...
0
votes
2answers
57 views

MySQL: How to fetch nth level child menus of a parent menu

I have a menu which is parent of multiple menu items and each child menu has their own child menus. This pattern is continued till 5-6 vertical hierarchy level. I don't want to write a query which ...
0
votes
2answers
48 views

write to SQL server from another server

I have 2 Windows 2012 virtual machines set up in Virtualbox - one called "AppServer" where I'll be installing applications, and another called "DatabaseServer" - where the application databases will ...
1
vote
2answers
61 views

Getting root node for a given leafs IDs

I got the following tables: +-----------------+ | PRODUCTS | +-----------------+ | #product_id | | #company_id | +-----------------+ | | +---------------------+ ...
0
votes
0answers
24 views

Facing Error while calling DB2 stored procedure from SQL Server 2000

I am trying to execute the following to call a DB2 stored procedure from SQL Server 2000. DECLARE @ICVR_CLAIM_NBR VARCHAR(19) SET @ICVR_CLAIM_NBR= 'XXXXXXXXXXX' EXEC('call PPSPCOL.X2COVSEL (?)', ...
0
votes
1answer
68 views

How can I reseed all identity columns?

I deleted all rows from 20 tables after disabling the constraints, triggers using the stored proc SP_MsForEachTable. Now before the import happens, I need to reseed all the identity columns back to ...
2
votes
2answers
60 views

Slow fulltext search due to wildly innacurate row estimates

Fulltext queries against this database (storing RT tickets) seem to be taking a very long time to execute. The attachments table (containing the fulltext data) is about 15GB. The database schema is ...
3
votes
1answer
111 views

“A severe error occurred” - Login Failed (but only occasionally)

I'm using a C# application to execute a query against SQL Server. Here's the relavent portion of an exception I'm encountering once every twenty-four hours or so: System.Data.SqlClient.SqlException ...
0
votes
1answer
64 views

How to copy database from server to local machine in SQL Server Management studio? [closed]

I am pretty much new to SQL Server Management Studio. I connect to SQL Server using Windows authentication. But not sure if my work affect the server database. How can I make sure not to mess with the ...