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
27 views

Rebuilding of Index in LogShipping DB in SQL Server 2008 R2 Standard version

Recently I joined the new organization and I am new to Log Shipping. After joining new company I found the fragmentation size of clustered indexes approx 256 indexes more than a 80% and I got the task ...
0
votes
1answer
28 views

import text file getting command is not allowed with this MySQL version

here is my table CREATE TABLE cities ( country CHAR(2), city_ascii VARCHAR(100), city VARCHAR(255), region CHAR(2), population INT UNSIGNED, ...
0
votes
0answers
51 views

Help with Joins - Cartesian Product

I have 5 regions that each contain 1 store and 1 warehouse. I have a table that contains the regions and corresponding stores and warehouses. I also have a table that lists the inventories of both ...
2
votes
0answers
22 views

Snapshot Agent - Transactional Replication - Why a complete snapshot?

Often, I will add a single article to an existing transactional replication publication. I then start the snapshot agent to copy the new article and it's data over to the subscriber. Most of the time, ...
1
vote
2answers
76 views

How to List SYNONYMS that no longer point to a valid object?

I have a table (OBJECTS_TO_UPDATE) with several objects I need to update, some are SYNONYMs for objects that no longer exist. I want to create a query to list them. But I am stuck. My table ...
2
votes
2answers
142 views

SQL Server DROP Database which is in a long roll back process

I have a DataBase that is taking very long to rollback a transactions. Which could be normally because it is rolling back a hugh amount of data. However I have the scripts to create the DB again and ...
0
votes
2answers
77 views

what could be the Best practices with very very large amount of data [closed]

I have a question on building a solution.I have a few txt/csv file having huge amount of data approx 30000000000 rows .By size they are 1.5 TB.The tables based on these data are only for lookup,I ...
0
votes
1answer
27 views

Count values of a column

I've got two database tables: Persons id user product 1 1 3 2 1 5 3 1 7 products id kilo 3 8 5 15 7 3 I'm wondering how to count values from a ...
1
vote
0answers
114 views

SQL Agent After installation not able to start

SQL Server 2012 SQL Agent will not start after installation. Checked permissions, on surface configurations, all OK, have tried to run it as another account no Joy. The error i am receiving is the ...
0
votes
1answer
70 views

Behaviour of RAISERROR within a TRY/CATCH within a loop

I have just encountered a section of SQL that is behaving not as I would expect (See below for a distilled version of the SQL in question that demonstrates the problem pattern). (This is on SQL ...
1
vote
1answer
53 views

Correct way to uninstall SQL Server 2008 ( or above )

Since University I've been facing this problem... How do I uninstall SQL Server? What I've done is: Delete everything in "control panel" related to SQL Server. But, is there a right way to ...
1
vote
1answer
31 views

“No Loop” Constraint for hierarchical data in postgresql

I've got table like this in postgres: id primary key parent_id foreign key on id some data columns I need no a constrain which prevents cycles on the parent relations. There might be more tree in ...
1
vote
0answers
31 views

adding a new partition takes a long time

I am adding a new partition and it takes too long to get this task done. ALTER TABLE attribute_usage_information ADD PARTITION ( PARTITION AUI_2015001 VALUES LESS THAN (735964) ) I am new to MySql ...
0
votes
0answers
35 views

Hsqldb and tomcat - permission denied or .lck file not found

I have an app running on tomcat7. For the database purpose, I am using hsqldb(1.8.0.7). In the webapp, I have several sql commands I want to run. However, the schema is not loaded from the app. I do ...
0
votes
1answer
28 views

Will canceling InnoDB compression that's already in progress corrupt data?

I have a 155GB table that is in the process of being compressed. ALTER TABLE $table_name ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; This compression has been running for a long time and is impeding my ...
0
votes
1answer
49 views

How to get average according to last update time?

There is table - Item below, how can I get the average Value according to its 15 minute value from last record time? I am using SQL Server 2008. Table -- Item Table 15min_AVG
2
votes
1answer
83 views

Should database be denormalized if I need an index across multiple tables

I have a catalog of album and song names. The song has a foreign key to the album table. I expect queries like: SELECT * FROM song s JOIN album a ON a.id = s.album_id WHERE LOWER(CONCAT_WS(' ', ...
0
votes
0answers
27 views

Question? Creating a website that has 2 sets of intermidate tables

I am creating a web site that uses 6 tables from one database in mysql (example) 2 sets of tables that connect to intermediate tables (using foreign keys to join the tables). 1) Category -> ...
1
vote
1answer
50 views

Insert rows in a table, via a row-level trigger, activated after insertion in that same table

I have to design a schema and trigger system in SQL that will save words and their synonyms. I thought of this basic schema: create table words ( id int primary key auto_increment, word ...
2
votes
1answer
72 views

Help Changing Collate of ALL databases

I have approximately 80 Databases with various collations. I would like to modify the collation of all 80 databases. I have the following code: USE [COLLATE_ADM] GO SET ANSI_NULLS ON GO SET ...
0
votes
2answers
47 views

MS Access Query to update

Trying to update Packet.MSGState to P where if not R or D and it is Y in table Packet.MSGState UPDATE Packet SET Packet.MSGState = 'P' Where (MSGState <> 'R' and MSGState <> 'D') and ...
1
vote
1answer
27 views

Trigger that records values for 5 columns from 3 tables when a value for column Z in table 3 is of a certain value

I am new to triggers and SQL in general. Sorry in advance if this forum is only for experts and this is a newbie question... I need to create a trigger that fires when someone tries to submit a ...
0
votes
1answer
17 views

Selecting one variant out of different similar results

I have a table that looks as follows: Book Format Contents A html ... A markdown ... B html ... C markdown ... I want to return only 1 version of a book. ...
0
votes
2answers
56 views

what is a good use case for splitting user table by role

I have a requirement where there are primarily 5 roles in the system. Each of these roles increase in hierarchy from junior to senior most role. Each junior role is a subset of its immediate next ...
2
votes
1answer
55 views

Having problems with concurrency while trying to lock a record in custom messaging system (Queue)

We are building our own custom messaging system and are having concurrency issues. Here are the rules: A process (EXE) console application locks 3 records and returns them No other process running ...
0
votes
2answers
172 views

Adding Last 12 Months to a row in a table (SQL Server)

I want to add the last 12 months to a SQL Server table, something like the following: FixedText Jan-14 Feb-14 Mar-14 Apr-14 May-14 Jun-14 Jul-14 Aug-14 Sep-14 Oct-14 Nov-14 Dec-14 Jan-15 Please can ...
1
vote
2answers
109 views

Should I set document version field to be part of a primary key

Should I set document version as a primary key I am working on a document management system, and I have these two tables representing part of the whole tables. On the DocumentVersion table I have ...
1
vote
1answer
38 views

Having troubles creating table SQL [closed]

I'm new to SQL and Im trying to create a simple database, but I'm having problems with second one, I'm using Oracle Database express 11 and when I try to run this code I get error: Missing right ...
8
votes
2answers
222 views

Are “out of the row” fields read when a clustered index is used?

I know that when VARCHAR(MAX)/NVARCHAR(MAX) columns are used the data is stored out of the row - the data row will have a pointer to another location where the 'large value' is stored. I have the ...
5
votes
1answer
327 views

Why not rebuild indexes with page count <1000?

I use Ola Hallengrens script for Index maintenance. Before I did that, I used the following query to see which indexes are fragmented most: SELECT dbschemas.[name] as 'Schema', dbtables.[name] as ...
0
votes
1answer
39 views

decrement all columns entry when row is deleted

I have a column in a table containing the row_number, some kind of id number to identify the row. When I delete one row, I need the other rows to have their row_number decremented, to keep them ...
2
votes
2answers
56 views

What is meant by churn?

I came across the following sentence in this blog post: Know your data - this helps you make the right decisions in terms of data types/nullability and churn helps with long term maintenance ...
0
votes
0answers
126 views

Unable to connect to or create SQL Server database using asp.net [closed]

In my asp.net project I have SQL Server database with some tables. Unfortunately my PC was not properly shut down and and after that I am unable to connect to my database from Visual Studio (I am ...
1
vote
1answer
89 views

What do these parameters mean at the beginning of my SQL Server query plan?

I'm looking at query plan in SQL Server Mgmt Studio and I see something like this: (@P0 nvarchar(4000), @P1 nvarchar(4000)) Update... What does the type mean beside the parameters? For this example ...
0
votes
2answers
369 views

Check if database has changed to determine need to perform backup

I want to check SQL server database is modified or not. Reason to check database is modified is for backup(sql database backup) purpose. So I will be doing a full backup first and if any data ...
1
vote
2answers
87 views

Understanding multiple table join with aggregation

I have a basic question on how JOIN works on multiple tables. I want to count occurrences of Foreign Key in link1 & link2 CREATE TABLE main ( id SERIAL PRIMARY KEY, name text NOT NULL ); ...
0
votes
2answers
35 views

sync 2 tables in a single database in mysql with no duplicacy [closed]

I have 2 tables in a single database of MySQL. The structures are like this: mysql> desc main_tbl; +-----------------+--------------+------+-----+-------------------+----------------+ | Field ...
0
votes
2answers
79 views

How can i automate the process of log shipping monitoring

I have log shipping configured between my Prod SQL server 2005 and QA SQL server 2005. Per the requirement from Business we need to provide them with a report at the end of the day for the LOG ...
0
votes
1answer
71 views

SSIS Dataflow Task issue, moving data from SQL Server 2008 to MySQL via ADO.Net

Can you please help me in getting this problem solved.. I'm trying to build a SSIS package where I'm moving the data from SQL Server 2008 to MySQL. However I'm getting a weird problem in dataflow ...
1
vote
2answers
58 views

Get the pais_id not associated to fabricante_distribuidor_id and producto_solicitud_id, the opposite from SELECT query

I have this query for get all the pais_id given a fabricante_distribuidor_id and producto_solicitud_id, the query works fine. SELECT DISTINCT nom.pais_id FROM negocio.fabricante_producto_solicitud ...
1
vote
3answers
91 views

How to see percentage of existing values for all columns in mysql table?

I have three large-ish tables (~20 columns each) and I want to know what percentage of rows have a value for each column. For instance, this table: ID | TITLE | SERVING | NOTE ...
1
vote
2answers
89 views

How to calculate a total by comparing current and next row

I have a table with some rows: I have a few questions to accomplish the task altogether. Is it possible to calculate total of transmitted and received based on checked_date and ip and connect_time ...
3
votes
2answers
356 views

Getting the number of Saturdays and Sundays in a month

I am trying to get the number of Saturdays and Sundays for a given month represented by an end_date and a start date. I have been trying to understand the algorithm in the SO question here . I have ...
0
votes
1answer
28 views

Update different oracle database from different oracle database

I want to update a CLOB column in B Oracle 11g database using a CLOB column in A Oracle 11g database located in a different server. What are the different ways to do that? and which is the best and ...
-3
votes
0answers
42 views

The SQL server Log folder is expanding because of the SQL Dump files (what to do with it ?) [duplicate]

The "Log" folder SIZE in the SQL server root directory (X:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log) becomes too big , ~80 GB. When I checked it, I see that there are a lot of ...
-1
votes
1answer
90 views

The SQL server Log folder is expanding because of the SQL Dump files (what to do with it ?)

The "Log" folder SIZE in the SQL server root directory (X:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log) becomes too big , ~80 GB. When I checked it, I see that there are a lot of ...
1
vote
2answers
73 views

Shrink logs in between user transaction in SQL Server

I have a database where there are like billions of rows and I need to delete the data based on some condition. Initially I was trying to delete the code in one transaction and log starts growing to ...
2
votes
1answer
57 views

MySQL WHERE if NULL select another column

This is my mysql table id date_created date_active 1 2014-06-07 18:24:38 NULL 2 2014-06-07 18:24:38 2014-06-07 18:24:38 3 2014-06-07 18:24:38 ...
1
vote
1answer
32 views

Finding out the exact size of the database after inserting records?

I have this query: SELECT table_schema "db.name" , Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables GROUP BY table_schema; Does this ...
1
vote
2answers
96 views

How to tune the below query

I am currently working on below table structure to pull the data/ generate any one time report. Let us consider the table name to be ABC. ID Field Value 1 Name Nagarjuna 1 Gender Male 1 ...